mta452 / SheenFigureLegacy

A library to render arabic/urdu fonts on smartphones.
Apache License 2.0
30 stars 6 forks source link

Malayalam support #3

Open jeesmon opened 11 years ago

jeesmon commented 11 years ago

Hi,

Thanks a lot for this library. I'm trying to get Malayalam rendering using your code. But ligature substitution is not working. Could you please point me to the code where I should be looking? Here is the font that I use http://jeesmon.csoft.net/fonts/Kaumudi.ttf

ex: ത + ് + ത (\u0D24 + \u0D4D + \u0D24) should render ത്ത (glyphid: ml_t_ta (65581))

Thanks, Jeesmon

mta452 commented 11 years ago

First of all, you should understand open type font specifications for Malayalam script as described at: http://www.microsoft.com/typography/OpenTypeDev/malayalam/intro.htm

The problem is not ligature substitution. It only works for allowed scripts and features. You should change these for both substitution and positioning.

To change script for substitution, open SheenFigure/SFInternal/SFGSUBUtilization.c, locate line no. 88 and change variable gsubFeaturesTagOrder to have those tags as described in microsoft page's shaping features paragraph. Also locate line no. 604 and change script tag from "arab" to malayalam's tag. (I don't know that)

To change script for positioning, open SheenFigure/SFInternal/SFGPOSUtilization.c, locate line no. 28 and change variable gposFeaturesTagOrder to have those tags as described in microsoft page's positioning features paragraph. Also change script tag at line no. 622.

Please note that, I have not tested Context Substitution and Positioning tables and therefore they are not supported. So if your font uses these, you will have problems.

jeesmon commented 11 years ago

Thanks a lot for the quick reply. I made changes as you suggested. Now I can see the ligatures are formed correctly. Still some issues with re-ordering of glyphs. Please see the attachment. In the red box, those two chars should be reversed (should be തെ). Any hint to fix it?

Screen Shot 2013-01-10 at 12 16 35 PM

mta452 commented 11 years ago

Hi,

Note that some processing is done manually; like in arabic there are four forms of an alphabet and the font does not provide information about which form should be used. If this is also the case in Malayalam, you'll have to include the code for initial processing of text.

Also note that, text is reversed before processing because Arabic/Urdu is a right-to-left language and SheenFigure focus on them.

I checked the font you provided. Almost all tables in it are ligature substitution and there is no positioning table. I don't think the problem is in the library.

I would have fixed the issue if I knew Malayalm :)

Hope you can fix it yourself.