iPhone

A Tough Road to Khmer Unicode on iPhone

UPDATE: 05/05/09

Copying all the glyphs from KhmerOS fonts to arialuni.ttf, help showing Khmer in title bar and other native iPhone App (contact, sms) but still no rendering.

What you need?

1. Jailbroken iPhone

2. Khmer Unicode fonts

3. WinSCP (Windows) or Fugu (Mac OS X)

4. Make sure that Erica’s Utilities is installed in Cydia

So, how do you start?

1. Well, use WinSCP or Fugu to connect to your jailbroken iPhone over WiFi (if you have your iPhone jailbroken, I expect you know how to install OpenSSH server on it). If you don’t know the default password for mobile and root user of the iPhone, google it.

2. Copy your Khmer Unicode fonts to /System/Library/Fonts/Cache/

3. SSH or Mobile Terminal to your iPhone and run the following command:

plutil -c xml1 /System/Library/Fonts/CGFontCache.plist

4. You can use “vi” command or edit function in WinSCP (File > Edit or F4) to modify CGFontCache.plist

vi /System/Library/Fonts/CGFontCache.plist

5. There are 2 parts that need to be updated.

5a. Names

It has the following syntax:

<key>Font Name</key>
<string>Full Path to Font File</string>

For example:

<key>KhmerOS</key>
<string>/System/Library/Fonts/Cache/KhmerOS.ttf<;/string>
<key>KhmerOS Bold</key>
<string>/System/Library/Fonts/Cache/KhmerOSBold.ttf</string>

5b. The second part is TraitMappings:

It has the following syntax:
<key>Font Family Name</key>
<dict>
<key>Plain</key>
<string>Font Name</string>
<key>Bold</key>
<string>Font Name</string>
<key>Italic</key>
<string>Font Name</string>

<key>Bold-Italic</key>
<string>Font Name</string>
</dict>

6. Respring/Reboot your iPhone to load the new fonts and test them.

7. Do i even need to show you how to test them?

Note: You will be able to view the base characters but there’s no rendering as of yet.

and now with KhmerOS fonts.

Mobile Safari does not know what Khmer is, so the fonts added to iPhone has to match the CSS style.