Wednesday, January 21, 2009

Hindi is broken on iPhone (as of 2.2)

This afternoon I decided to wrap the (public-domain) text of a Hindi short story (by) in a little application to run on my iPod Touch, as what you might call a standalone e-book. I hadn’t really done any Hindi browsing on the device so far but when I’d first tried it I had easily managed to rename a well-known Hindi song successfully from ‘Mere Mehboob’ to , and it’d showed as such on the iPod.

So, naturally, I was encouraged and had expected things to go smoothly with the little ebook app.

Fail! The Devanagari script (Hindi as it is written) is badly broken on the iPhone platform. The chhoti-I matra, the short ‘i’ sound as in kick does not render correctly at all.

It should be before the consonant to which it is attached:

It renders instead as follows, after the consonant:

This is not a valid expression in Devanagari. It is lamentable that Apple went far enough to support the script at all and then neglected this little show-stopper at the tail end. Especially because it works well on OS X and you’d think they’d share some tests with the iPhone platform.

Xcode (correct):

iPhone simulator (incorrect):

You could disregard this and get by with a mental re-ordering of the I-matra if you must, but it’s still not what you’d expect in an Apple device.


namrata said...

I am also facing this problem of small I-matra shifted one position to right, on and embedded arm board on firefox-3.0.8 browse. can u suggest me in this matter

v_tel001 said...
This comment has been removed by the author.
v_tel001 said...

Looks like all Indic scripts are broken on the iPhone 3G. (the 2G did not even support them)

The screenshots for
Hindi and
TeluguDo you think jailbreaking the device, and installing a Mac-specific font is a solution?

Karan Vasudeva said...

Yes, there are some very good non-Roman keyboards if you jailbreak the device, via something called iKeyEx. You'll also be able to install new fonts if you do, and that might solve the display half of the problem (the keyboard extension solves input).

I believe Arabic is supported quite well in this way on jailbroken devices.

v_tel001 said...

Thanks Karan. I may have to go that route. But does not seem like a permanent solution which can used by the masses or in commercial apps. I use an app called Hindi Samachar,समाचार/, and the app. creaters suggest us to get used to the issues in Hindi display!!

"NOTE: Due to limitations of the iPhone, Devanagari
script doesn’t show properly and you may have issues reading certain words. But with practice you get used to it and it and reading becomes better."

Karan Vasudeva said...


This is exactly why I started work on my own embeddable font engine. Unfortunately that is nowhere near completion and I've been kept too busy in my full-time job to have finished it (but I will, one day).

Dan said...

The Android platform has the exact same problem (for the 2 or 3 apps that support Devanagari at all). Very odd that both these phones have the same bug.

Karan Vasudeva said...

I believe Devanagari fonts depend on reordering of glyph-pairs to be encoded in the font (in OpenType tables; not sure but I think in this case it might be the GPOS structure) and to be interpreted and implemented by the font engine. I'm guessing that the fonts are identical to those distributed on the desktop but the font engines don't support OpenType tables.

Yes, it's curious that font engines on both platforms lack support for the same table. On the other hand, it's probably not a necessary feature for the more popular scripts these devices need to support.

If they run the exact same engine though, the Arabic family might recently have started rendering correctly on Android (as it has on iPhone; I think they've added support for GSUB tables). Is that so?

Dan said...

I will be happy to test Arabic rendering. I do not know the language at all, but if you give me an English word that used to render incorrectly, I will put it into the translate app and see if the PC and Android have the same glyph ordering.

Karan Vasudeva said...

You could try opening the Wikipedia page for Arabic itself, on the device:

Please compare differences in the rendering of Arabic words on that page, on the desktop vs on the device.

My mac is at the service centre with a dead harddisk or I'd attach images of correct and incorrect rendering for easy comparison!

Dan said...

The browser does not support Arabic at all, but some apps do. In those apps, from what I've tested, the Arabic font is not correctly rendered, just like Indic fonts. I've filed an android system bug for the issue, if anyone finds this thread and wants to follow the progress.