我使用freetype来渲染单个字符,我可以使用一些额外的数据来创建长字符串。 但对于像印地语或藏语这样复杂的语言脚本,你需要一个高级逻辑来连接所有这些下标,上标,复杂的辅音等。这应该如何处理? 在freetype之上是否有一个库,或者我找不到freetype中的函数?
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?
最满意答案
实际上,在SO上要求/推荐库是OT,但我认为唯一的开源选择是Pango :
Pango是一个用于布局和呈现文本的图书馆,重点是国际化。“
[...]
Pango包括PangoLayout,一个用于布置整个文本块的高级驱动程序,以及帮助编辑国际化文本的例程。
请参阅脚本库 ,了解它可以处理的欧洲和其他脚本的选择 - 我没有看到印地语(梵文)或藏文,但它似乎很可能也没有任何问题。
Pango内部使用“ Harfbuzz进行复杂文本处理”。 您可以尝试两种方法,看看需要多少工作才能单独使用Harfbuzz获得所需,或者直接进入Pango并获得全包服务。 (我想知道在功能中划分界线的位置。)
仅供参考:FreeType缺乏的“高级逻辑”的一部分可归因于处理OpenType定位和字形替换。 FreeType开发人员似乎主要集中在绘制字形(请参阅http://freetype.org/opentype/index.html ),将物流外包给Harfbuzz。
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.
更多推荐
发布评论