SDL_ttf + HarfBuzz


Here’s a ticket:
with a modification of SDL_ttf to get it working with the text shaping
engine “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 (,
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.



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