سؤال

I use freetype to render single characters, I can use some additional data to create long strings. But for complex scripts of languages like Hindi or Tibetan you need an advanced logic that will connect all those subscripts, superscripts, complex consonants etc. How is that supposed to be handled? Is there a library on top of freetype or there are functions inside freetype that I cannot locate?

هل كانت مفيدة؟

المحلول

Actually it's OT on SO to ask for/recommend libraries, but I think the only open source choice is Pango:

Pango is a library for laying out and rendering of text, with an emphasis on internationalization."

[...]

Pango includes PangoLayout, a high level driver for laying out entire blocks of text, and routines to assist in editing internationalized text.

See the Script Gallery for a selection of European and other scripts that it can handle -- I don't see Hindi (Devanagari) or Tibetan, but it seems highly likely it has no problems with either.

Pango internally uses "Harfbuzz for complex-text handling". You could try both, and see how much work is required to get what you need using Harfbuzz alone, or go straight to Pango and get the all-inclusive package. (I wonder where to draw a dividing line in the functionality.)

FYI: part of the "advanced logic" that FreeType lacks can be attributed to handling OpenType positioning and glyph replacement. The FreeType developers appear to have concentrated primarily on drawing glyphs (see http://freetype.org/opentype/index.html), out-sourcing the logistics to Harfbuzz.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top