The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL_ttf + HarfBuzz
slvn


Joined: 06 Oct 2012
Posts: 88
Hi,

Here's a ticket: https://bugzilla.libsdl.org/show_bug.cgi?id=3046
with a modification of SDL_ttf to get it working with the text shaping engine "HarfBuzz" (http://www.freedesktop.org/wiki/Software/HarfBuzz).

SDL_ttf render correctly many languages, but for a few others there are troubles: wrong glyphs, inversed characters, bad positioning.
For instance, all this languages render incorrectly: arabic, bengali, burmese, hindi, kannada, khmer, lao, malayalam, marathi, nepali, persian, sinhala, tamil, telugu, thai.

The issue is that SDL_tff library has to process the string before rendering it, in order to do things like "typographic ligature" and "contextual pattern substitutions".
Those rules are stored in the font ".ttf" file, in the GSUB table (http://partners.adobe.com/public/developer/opentype/index_table_formats1.html), this quite difficult to decode and also to apply.
That's what HarfBuzz does (among other things).

The patch is not meant to be merged because it adds a new dependency that may not be wanted. But, if you plan to render some of the previous languages, you definitely need it.
I have tried ~70 languages, on Linux + Android with success.


Cheers,


Sylvain


PS: thanks to some example found on the mailing about using SDL + HarfBuzz.