Tuesday, January 15, 2013

Create your own Malayalam flip font for Android

Certain Samsung devices allow you to change system font by installing flip font (font apk). Your device should have Settings -> Display -> Font Style option for this to work. Not all Samsung devices have this option.

Creating a flip font is an easy task. You can find many posts about this on the net (mainly in xda forums) but creating a Malayalam font apk is little tricky. Steps mentioned in other places will not work for Malayalam font as the process will not copy GSUB tables correctly to the digitally signed font.

Tools needed:

  1. Windows machine
  2. Fontforge (http://sourceforge.net/projects/fontforge/files/latest/download?source=files)
  3. Apk Manager v4.9 (http://goo.gl/GKBHM)
  4. A working flip font (http://goo.gl/cfTJU)
  5. A blank digitally signed font BlankSigned.ttf (http://goo.gl/Gefuf)
  6. A font that you want to convert to flip font
Steps:

Create signed font
  1. Install Fontforge
  2. Download BlankSigned.ttf to local disk
  3. Run Fontforge
  4. Open Font -> Browse and select your font (ex: MyFont.ttf)
  5. File -> Open -> Browse and select BlankSigned.ttf
  6. Element -> Merge Fonts ... (Make sure you select this option from BlankSigned.ttf font window)
  7. Click OK. This will merge your font with BlankSigned.ttf font.
  8. File -> Generate Fonts ... -> Select TrueType for font type -> Enter a name for the font (ex: MyFont.ttf) -> Save. Try to use a font name without special chars or numbers to make things easier.
  9. If you get Errors detected window, just click Save
  10. Now you have a digitally signed font that you can include it in font apk
Create font apk
  1. Download Apk Manager v4.9 and unzip to local disk
  2. Copy working flip font (Kaumudi.apk) to apk_manager_4.9\place-apk-here-for-modding folder
  3. Open cmd window and cd to apk_manager_4.9
  4. Run "Script.bat"
  5. Press any key to continue on adb warning
  6. Type 22 and hit enter
  7. Type 1 to select Kaumudi.apk. If you see multiple apks, type the number corresponding to Kaumudi.apk
  8. Type 9 and hit enter to decompile apk. Don't close cmd window. We need it for later.
  9. Now you will see apk_manager_4.9\projects\Kaumudi.apk folder in file system
  10. Replace Kaumudi.ttf in apk_manager_4.9\projects\Kaumudi.apk\assets\fonts with your signed font (ex: MyFont.ttf). I'm going to use MyFont as the name of new font for rest of the steps. Change it to your actual font name. Also rest of the steps are for the files/folders in apk_manager_4.9\projects\Kaumudi.apk folder
  11. Rename assets/xml/Kaumudi.xml file to assets/xml/MyFont.xml
  12. Rename smali/com/monotype/android/font/Kaumudi folder to smali/com/monotype/android/font/MyFont
  13. Open each xml, yml, smali files in apk_manager_4.9\projects\Kaumudi.apk folder and sub folders in a text editor and replace Kaumudi with MyFont
  14. Switch back to cmd window
  15. Type 11 and hit enter to compile apk
  16. Type n for system apk and hit enter
  17. Type 12 and hit enter to sign apk
  18. Now you will see signedKaumudi.apk in apk_manager_4.9\place-apk-here-for-modding folder. Rename it to MyFont.apk. That's your flip font.
  19. If you have followed instructions correctly, you now have a flip font that you can install on your device.
Let me know if you find any errors in my instructions.