True Type字体轮廓重叠检测,并合并C#
我有一个显示 true type 字体的应用程序。有时我需要组合两个字符(例如印地语),这可能会重叠。我需要一种算法来检测两个字体轮廓何时重叠,并将两个轮廓合并为一个。
I have an app that displays true type fonts. I need to combine two characters some times (e.g. Hindi), that may overlap. I need an algorithm to detect when two font outlines overlap, and merge the two outlines into one.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果字体是 OpenType,那么它可能已经具有代表这些“重叠”轮廓的轮廓。在字体术语中,这称为连字;一个典型的例子是字符串“ffi”。请参阅 http://en.wikipedia.org/wiki/Typgraphic_ligature< /a>.
棘手的部分是检测字符代码的正确序列并将其替换为适当的字形轮廓。我不确定 C# 是否有 API 可以做到这一点,但 Pango 库 (http://www.pango.org/) 应该能够处理这个问题。
If the font is OpenType, then it may already have an outline representing these "overlapping" outlines. In font terminology this is called a ligature; a classic example is the string "ffi".see http://en.wikipedia.org/wiki/Typographic_ligature.
The tricky bit is detecting the correct sequence of character codes and replacing it with the appropriate glyph outline. I am not sure if C# has an API to do this but the Pango libray (http://www.pango.org/) should be able to handle this.