Aun Rizvi Aun Rizvi - 9 months ago 51
Android Question

Indic languages on Android browser/GUI (Gujarati) improper rendering

I have a website specifically for viewing on Android devices, I am using Gujarati languages and i have a big problem rendering the Gujarati Fonts properly, I atleast want a workaround to get the Gujarati fonts Working properly which is by default not supported on any Android versions. And so i did,

The Work around:
- Rooting the phone
- Finding the correct unicode font for Gujarati language
- Replace the existing DroidSansFallback.ttf in System/fonts with the Gujarati Font (with some extra changes in fontsfallback.xml in system/etc folder for ICS)

This Helped me to atlest view Gujarati texts, but not correct rendering.

The Problem:

1) Problem of Half forms, the half form letters are not rendering properly as they are suppose to combine but they dont,

If you refer to this faq on, it clearly defines how it should render,I have also used the mentioned "Zero Width Joiner" by using html codes for every letter using [unicodeLookup][7] but it has no effect.

Anyways This problem is not primary as it is improper but still not incorrect.

2) This rendering problem makes the texts print incorrectly, See the two images below, First one is correctly render as visible on PC and second on is a screenshot from Android native browser


the problem marked as 1 are fist problem and the one marked as 2 are second problem, if you google "Devanagari - Unicode Consortium ch09" you will get a pdf refering to this problem (just goto "Figure 9-8. Rendering Order in Devanagari") which clearly explains the method to render the scripts correctly. It seems what ever android uses to render the scripts is not supported for such languages, if there is any change that can be made to Android OS to render the fonts in correct order, please help.

This is definitely not a problem with fonts as i have tried using Shruti fonts which is used by windows OS, it is a problem with rendering these complex scripts

Possible Solutions: (unwanted)

1) Using opera mini with bitmap fonts (not my solution)

2) Use Images instead of texts (again not my solution as my site will have 300 lines of lists and that too for mobile, do not want to increase page size)

Please give me a proper solution to this problem, thanks in advance !!

Answer Source

Rendering Gujarati (and other "complex" scripts, i.e. those which use half-forms, contextual forms, rearrangement, etc.) requires more than just fonts; it also needs text layout. Text layout capability is normally supplied by the host operating system or in some cases the application. Android has been improving text layout support, but even the latest version is still not complete for all scripts. In other words: you cannot easily fix this with fonts alone, even for recent versions of Android.

Possible workarounds:

  • develop some kind of plugin or extension that does correct Gujarati layout and require users to download/install the plugin to use your site. This will likely be a very high-impedance path, requiring a great deal of expertise in fonts, software development, and knowledge of the target writing system. Not to mention the inconvenience for your users.

  • develop a custom version of a Gujarati font and use corresponding custom text in your site that does not require text layout; supply the font via @font-face (webfont). This will also likely be fairly challenging if you do not have experience with font development, but would probably be the best path.

  • render the text to images; do browser-sniffing and supply images for cases where the client is known not to support complex scripts. This is likely to fail much of the time (hard to keep track of browser capabilities, not to mention the problem of reliably detecting browsers to begin with). But guaranteed to give the right results.