4

At work, I have been tasked with improving the text rendering of our application to better support text character kerning. Our application generates images that appear on Television, so image quality is paramount. Therefore, even small improvements to the appearance of any output we generate is very useful.

Our current text engine is implemented using Uniscribe, which seems to be an ideal solution. As mentioned here, it supports ligature substitution in a context aware fashion with complex scripts. It also handles right-to-left languages, and BiDi. This is all important as we need to be able to render arabic/cursive languages perfectly.

It therefore seems rather peculiar that Uniscribe doesn't appear to output glyph kerning information. I have attached a screenshot to demonstrate the issue.

alt text http://www.aliparr.net/kerning.jpg

My app performs the same as notepad in that every glyph appears 'monospaced'. Notice how in Photoshop CS2, the bridge at the top of the 'T' nicely overhangs the 'e'. I want to recreate this.

I am aware of other APIs such as Pango/Freetype - but it seems a rather heavyweight solution to include all of that just to do the final 1% of this task, if Uniscribe is so great at everything else.

Am I missing a step using Uniscribe? What is the best solution to this? Can Freetype export kerning information in a lightweight fashion, so that I can integrate it with the existing Uniscribe solution?

N.b. We only need to run on Windows - platform portability is thankfully not an issue I need to worry about right now.

Cheers in advance !

4

3 回答 3

1

您可以使用 Uniscribe 手动实现字距调整。

我通过手动创建ScriptTextOutconst int *piJustify的参数来做到这一点。

// Initially the justification is simply a copy of the advance array
int* piJustify = (int *)malloc(pcGlyphs);
memcpy(piJustify, piAdvance, pcGlyphs);

// Apply kerning to each glyph
for (size_t i = 0; i < pcGlyphs; i++) {
    if (psva[i].fClusterStart) {
        // Only add kerning to the first glyph in each cluster
        piJustify[i] += myKerning;
    }
}

这假设您已经为 和 调用了 ScriptItemize、ScriptShapepcGlyphspiAdvanceScriptPlace psva

于 2013-12-27T08:50:28.923 回答
0

默认情况下,如果所选字体支持,ScriptShape/ScriptPlace 会应用字距调整。但是,如果您想打开/关闭它,您应该使用 uniscribe 的 OpenType Api。

于 2014-10-30T16:52:35.073 回答
0

如果您在 Windows XP 上运行,我相信您必须在控制面板的区域选项中启用以下选项:

  • 为复杂的脚本和从右到左的语言(包括泰语)安装文件
  • 安装东亚语言文件

让 Uniscribe kerning 工作。

于 2009-11-21T00:06:39.997 回答