[Milestone XT720 General] sohrab.naushad:
Hey guys,

Changing my android font is one of the first things I do everytime I flash a new ROM. The plain arial font always seems so bland. Me being a huge linux fan and Ubuntu user I love the custom Ubuntu font that the distribution uses. Alot of effort and research went into the making of these fonts and they look beautiful on android. So I thought i'd write a small tutorial on how I do it. This can work for any font, but I have used it only for the Ubuntu font. Beware if you try using very funky fonts, you can get UI defects here and there. Also please be sure you understand whats going on here before trying because if they dont replace the old fonts properly youll be stuck at the boot animation screen and will have to reflash your ROM. So here goes.

Step 1: Download your required font

Your font needs to be in the .ttf format for it to work. Since Im using the ubuntu font I will give you the link for where to download that. You only need 2 versions of the font for use on android. Regular and Bold. Here is where you can download the ubuntu font set: http://font.ubuntu.com/download/ubuntu-font-family-0.71.2.zip

Step 2: Place font in your ADB folder

In the new version of the Android SDK ADB has been moved to platform tools. If you are using the older version then its probably in the tools folder. Place your two desired fonts in the ADB folder. The next step is renaming your fonts. Rename your fonts in the following way. You have to rename them exactly the same for it to work. Basically what you are doing is pushing your custom font over the old one and fooling android into using your font. Thats why you need to rename them exactly like they are in the default. E.g for the MIUI ROM, you need to use root explorer and see what the fonts are named because its different from the froyo builds. If you're using the the XT720 froyo builds you can rename them as follows.

Regular font: DroidSans.ttf

Bold Font: DroidSans-Bold.ttf

Step 3: Setting up and mounting your /system/fonts/ Folder

Okay now you basically need to mount your system folder and for that you have to use the ADB tool. Run the following 3 commands to mount your folder.

adb shell
su
mount

After you enter mount you will get output which will look something like this:

rootfs / rootfs ro 0 0
tmpfs /dev tmpfs rw,mode=755 0 0
devpts /dev/pts devpts rw,mode=600 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
tmpfs /sqlite_stmt_journals tmpfs rw,size=4096k 0 0
none /dev/cpuctl cgroup rw,cpu 0 0
/dev/block/mtdblock7 /system yaffs2 ro 0 0
/dev/block/mtdblock9 /data yaffs2 rw,nosuid,nodev 0 0
/dev/block/mtdblock8 /cache yaffs2 rw,nosuid,nodev 0 0
/dev/block/mtdblock6 /cdrom yaffs2 rw 0 0

You need to see which dev/block your system folder is in. For all the froyo builds on the XT720 its usually dev/block/mtdblock7. See according to your own ROM.

Next we need to give the folder read write permissions.

mount -o remount,rw -t yaffs2 /dev/block/mtdblock7 /system

chmod 777 /system/fonts

After this we can exit the adb shell by issuing the command twice.

exit
exit

Step 4: ADB pushing your desired font

All you have to do is change directory to your ADB directory. In my case its platform-tools. Do according to your own folder names.

cd ~/android/platform-tools

Then push both fonts with the following commands.

adb push DroidSans.ttf /system/fonts/DroidSans.ttf

adb push DroidSans-Bold.ttf /system/fonts/DroidSans-Bold.ttf

Reboot your phone and enjoy your new font.

adb shell
su
reboot

Attached are some images of how my Ubuntu font looks compared to the old one. Not much of a difference but I still like it. If you have a favourite font give it a try.