freetype如何处理(组合)长字符串的复杂脚本(freetype how to handle (compose) long strings of complex scripts)

编程入门 行业动态 更新时间:2024-10-25 00:35:20
freetype如何处理(组合)长字符串的复杂脚本(freetype how to handle (compose) long strings of complex scripts)

我使用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.

更多推荐

本文发布于:2023-07-22 12:14:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1219928.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:组合   字符串   如何处理   脚本   freetype

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!