I wanted to install Bengali fonts in my Android device. I tried different ways to add Bengali font support in my Android device. And finally I ended up with fonts installed in Android emulator.
I followed different blogs where many people explained how to add system fonts in android devices. Some people say that we can install system fonts without rooting the device. On the other hand there are people who believes that the android device must be rooted to make changes to system fonts. I believe that the device must be rooted. Because all my attempts were unsuccessful with my un-rooted device.
Finally, I decided to install or change system font of Android emulator. I could replace system fonts using adb shell. But the problem was that the changes were not persistent. That is, system files are restored when the emulator is restarted. And that was a new challenge on my way. Please find the steps below that I followed to overcome this new challenge.
Note that we need a linux PC to execute the following steps.
- Extract system.img using uyaffs. You will find system.img in your ‘SDK_INSTALLATION_DIR/platforms/android-2.2/images/’ directory. Download the file unyaffs2 and change permission to add execute support. Now create a new folder where you want to extract all contents of system.img. Go to that folder and extract contents using the command ‘./some/path/to/unyaffs /another/path/to/system.img’. This will extract all contents in the current folder.
- Add or modify contents in corresponding locations. I replaced /system/fonts/DroidSansFallback.ttf with SiyamRupali.ttf (or SolaimanLipi.ttf) to add Bengali font support. Since I wanted to install Android Market application in the emulator I did edit /system/build.prop file (added # at the start of the text ‘ro.config.nocheckin=yes’). Also I followed necessary steps to install Android Market application in emulator here. Though this did not work for me, I would request you to read those steps.
- Re-pack system.img using mkfs.yaffs2.x86. You may download mkfs.yaffs2.x86 from here or here if the first link is not reachable. But I did not test those. The command to pack contents will be something similar to ‘./some/path/to/mkfs.yaffs2.x86 /your/image/dir/ /your/newimage/path/newimage.img’
- Now that you have created a modified version of system.img its time to run avd using that new image. Copy newimage.img to Android SDK installation location from where you copied system.img earlier to extract. Rename existing system.img to system.img.orig. Now rename newimage.img to system.img. Start avd and check if everything is OK.