Tuesday, January 27, 2009

A temporary fix for Hindi (Devanagari) on the iPhone

As I explained in my last post, the Devanagari rendering situation on the iPhone is dead on arrival. To wit, the chhoti-I matra (the vowel ‘i’ as in kick) is always rendered one position to the right of its conventional placement.

While explaining the problem to a keen-eared buddy this evening, it occurred to me that there was a simple fix ad hoc:

shift the chhoti-I matra one position to the left in the encoding

This is just fixing the symptom but there’s nothing else to be done (short of providing one’s own font engine) while we wait for Apple to fix this in the firmware. In any case, the lack of any symptoms is all that the discerning public cares for.

I’d remember to check for firmware version to be at most 2.2 with a message to [[UIDevice currentDevice] systemVersion], and remember to update things accordingly when the next firmware version is released.

Xcode:


iPhone simulator (correct - for now):

11 comments:

Gabbar said...

Hi,

I am deciding on whether to buy an ipod Touch or a Nokia 5800 to use as an ebook-reader-cum-pocket-computer. Based on viewing some Sanskrit and English-cum-Sanskrit documents, I observed that pdfs get rendered OK (by GoodReader) but horizontal scroll problem is a major issue.

Converting pdf's to epub using Stanza/Calibre using Sanskrit font led to the 'complex script' rendering problem that you have mentioned in your 'Hindi is broken on iPhone ...' blog entry. More details about my problem is given here: http://www.mobileread.com/forums/showthread.php?t=61633

With some browsing I am getting the impression that iPhone OS does not have 'complex script' support (neither does Windows Mobile). But Symbian seems to have this support and so besides pdf viewers (which may be using their own font engine instead of the OS font engine), ebook (epub) files (Sanskrit/Hindi) should also get rendered properly (by readers like Mobipocket).

What do you think?? Any help would be greatly appreciated :-)

Gabbar

Gabbar said...

Oops!! I did not mention that my viewing of pdfs and ebooks was done on my friend's ipod touch (2nd Gen).

Karan Vasudeva said...

Hi Gabbar (Singh??) :)

I don't know very much about Mobipocket on Symbian so I can't comment but it would seem best to verify that this combination works for your script before parting with the cash. I would find an actual device to test this, or if nothing else, write to the people behind Mobipocket.

My personal preference is still the iPod Touch because the touch screen is so much more responsive than Nokia's.

Best
Karan

Gabbar said...

Hi Karan,

Yes, my pen name is Gabbar Singh. The most memorable acting role that I have ever seen :-)

I am trying hard to get a Nokia touch screen device to check it out but .... And unfortunately the Symbian emulator does not load binaries meant for the phone device (you need to have the source code and compile it to run on the emulator).

As a device I find ipod Touch to be wonderful!! Apple comes up with these game-changing winners again and again.

However, Indian language 'complex script' display is too important for me to ignore. And BTW by 'complex script' I refer to Indian Language display issues as illustrated here: http://en.wikipedia.org/wiki/Help:Multilingual_support_(Indic)

Thanks for the suggestions.

Gabbar

vicky said...

Hi Karan

Quick question..how do I get xcode to use hindi strings (like you have in the example xcode snippet)

Karan Vasudeva said...

Hi vicky,

I just typed these in. System Preferences->Language and Text->Input Sources will let you select a Devanagari - QWERTY keyboard mapping. Selecting the checkbox 'Show Input menu in menu bar' might help. There's a keyboard layout viewer that is useful to learn your way around the Devanagari mapping.

Note that this sequence of commands is for Snow Leopard, but there is a Leopard equivalent with minor variations. That post was written on Leopard.

Karan

vicky said...

HI Karan

Thank You. I am able to type in now.

I see that "क्ष", "त्र", "ज्ञ" are not rendered properly on iphone. Is there some temp fix for this?

Karan Vasudeva said...

Vicky,

I hadn't noticed that. You're right.

You could try programmatically preparing a text file listing all Unicode glyph numbers from the Devanagari codepage. Those would be direct references to the original glyphs, and not digraphs or trigraphs that rely on a working font engine to reach the desired target glyph by substitution. Am I making sense?

Karan

ePandit said...

@Gabbar Singh,
गब्बर जी, विण्डोज मोबाइल ५ तथा ६ में हिन्दी समर्थन के लिये मुफ्त टूल उपलब्ध है - आयरॉन्स हिन्दी सपोर्ट। इसके द्वारा मोबाइल में एक वर्चुअल ऑनस्क्रीन हिन्दी कीबोर्ड जुड़ जाता है जिससे फोन में कहीं भी हिन्दी न केवल पढ़ सकते हैं बल्कि लिख भी सकते हैं।

विकिपीडिया पर यह लेख देखें - मोबाइल फोन में हिन्दी समर्थन

आयरॉन्स हिन्दी सपोर्ट का होमपेज - http://eyrons.in

ePandit said...

@Karan Vasudeva,

"I just typed these in. System Preferences->Language and Text->Input Sources will let you select a Devanagari - QWERTY keyboard mapping."

करण जी क्या आइफोन/आइपॉड टच में हिन्दी इनपुट के लिये व्यवस्था होती है, आपकी ऊपर की कमेंट से ऐसा संकेत मिलता है, पर यह स्पष्ट नहीं हो रहा कि आप कम्प्यूटर (Mac) पर कीबोर्ड जोड़ने की बात कर रहे हैं या आइफोन/आइपॉड पर?

Karan Vasudeva said...

एपंडित जी, आयरन की जानकारी के लिए धन्यवाद्!

मैं Mac की बात कर रहा था. आयफोन में सिवाय "फ़रार" होने के कोई चारा नहीं है - yellowsn0w में हिंदी का keyboard उपलब्ध है.