Posted by: glasskeys | 09/17/2011

How to use custom system fonts on Android CyanogenMod phones and tablets.

This tutorial will explain how one can replace the default Android font used by icons and system menus on CyanogenMod with a truetype (.ttf file) font of your choosing without the purchase of specialised third-party software to modify fonts. The only prerequisite is that you must use a terminal emulator to run commands on your tablet or mobile.

The terminal application I use on my tablet is the free and appropriately named Android Terminal Emulator app, available for download from here if you have not already installed an emulator of your own choosing. I will also be presenting the information in this tutorial from the perspective of a Windows user, although the same concepts can easily applied by users of Mac OS or Linux.

First things first – connect your tablet or mobile running CyanogenMod to your computer via the USB cable. The USB connected screen on your tablet will appear shortly thereafter prompting you to tap or select a button to connect to your PC:

After this button is tapped, another screen will prompt you to Turn on USB Storage, tap this button to enable your PC to view your tablet or mobile as a storage device, which will be needed shortly:

Select your favourite font, and copy its .ttf file located in the C:\windows\font folder. This is most easily accomplished by choosing View and Details from the menu in Windows Explorer. For Mac users, Apple has made this guide to aid in finding the location of fonts on OS X.

In this example, I chose the MV Boli font, right clicked the file and clicked copy on the shortcut menu:

The next step requires placing the copy of this file on our Android CyanogenMod based tablet or mobile. Most likely Windows will have assigned two drives representing your tablet, do not paste the font file on a drive if you see temporary files, or recovery folders as this screenshot illustrates:

Instead, choose the drive that is uncluttered and will be much cleaner in appearance. Keep in mind the assigned letter of the “good” drive usually falls after the “bad” one due to drives generally being assigned in alphabetical order -and- because we need the drive designated by Windows as the “USB storage” drive, so that we may paste our copied font file:

Disconnect your tablet or mobile from your desktop, and open the Terminal Emulator application mentioned earlier.
Type the following command at the $ prompt.
$ ls /sdcard/*.ttf
The system should return /sdcard/yourfontname.ttf like so:

If you do not see any file found by the system, then the font file was placed on the wrong drive and needs corrected.

Once the file is verified to exist in the correct location, superuser needs enabled, so that the system folder can be remounted in read-write mode. These steps “clear the way” for the font file to be placed in the proper spot and “visible” for use by Android.

Please note that the terminal prompt will change from “$” to a “#” after the first command is executed:
$ su
# mount -o remount, rw /system

The font that Android uses for icons and system menus are the DroidSans and DroidSans-Bold fonts. We can now make a backup of these fonts, before proceeding further. I chose to use the cd command to change directories directly into the fonts folder, then copy the files to the SD card with these commands:
# cd /system/fonts
# cp DroidSans*.ttf /sdcard

Because the stock font files have been backed up, we will remove the stock version DroidSans font files, creating new versions in their place with renamed copies of the custom font chosen earlier.

Use the next four commands, replace yourfontname.ttf with the name of the file returned by the ls command earlier. Please ensure to faithfully duplicate upper and lower case characters, otherwise the commands will not work properly as the Android linux shell is case-sensitive.
# rm -f DroidSans-Bold.ttf
# rm -f DroidSans.ttf
# cp /sdcard/yourfontname.ttf /system/fonts/DroidSans-Bold.ttf
# cp /sdcard/yourfontname.ttf /system/fonts/DroidSans.ttf

A final ls command should list the DroidSans-Bold.ttf and DroidSans.ttf files in the fonts folder:

Reboot your tablet and notice the new font style used on icon captions.

The “power down” menu utilising a custom font in menu options.

Last but not least, enjoy your new custom system font!


Responses

  1. thanks… liked it!

  2. Worked like a charm. Thanks for the tutorial. Was really very simple to understand and implement,

  3. Great! Ty

  4. How to enable superuser?
    “uperuser needs enabled, so that the system folder can be remounted in read-write mode”

  5. Everything seem good, but when come down to cp DroidSans*.ttf /sdcard. It shows: sh: cp: not found. Please help.

  6. Somehow it shows “cp” not found. Please help.

  7. I had problems remove and cp-ing the new files to the /system/fonts directory. I removed it while being root user (su), but rm constantly said it could not removed rm. And when I did a ls, the files where in fact gone. However a cp keep saying I can’t override the file, even with the -f option, because the file I try to override already exist :S

    Very strange problem…, maybe it’s because I use S2E (some files will be written to SD instead of system memory to safe storage).


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

Follow

Get every new post delivered to your Inbox.

Join 243 other followers

%d bloggers like this: