views:

469

answers:

1

After asking my previous question about Uniscribe glyph kerning, and not yet receiving an answer, plus further reading on google etc, it seems Uniscribe may not support extracting glyph kerning information from a font.

I therefore have a simple followup question - are there any good examples (preferably with some C++ code) of extracting glyph kerning information for a specified string from a font?

It's mentioned in various places that either Pango, QT or ICU are capable of doing this, but documentation is a bit thin on the ground and I'm struggling to know where to get started.

Any help pointing me in the right direction gratefully received. I already have code in place to render the glyphs in the desired way, I am simply after the extended kerning information, so I can position the glyphs a little nicer.

Thanks,

+2  A: 

OpenType fonts have two different ways to specify kerning information, both of which are optional:

  1. The kern table, inherited from TrueType. This table supplies kerning pair information (i.e. how much you should horizontally offset a particular pair of characters). Microsoft provides specs for this table and also supplies some Windows API functions such as GetKerningPair() and GetFontData() that could help you extract values.

  2. The GPOS table, an OpenType table which apparently handles every conceivable form of glyph positioning. Microsoft also has some specs for this table, but honestly I don't even know where you'd begin... You'd probably want to look at how ICU handles this sort of stuff.

I haven't found much in the way of code samples for any of this, though I'd imagine getting kerning values from the kern table is far simpler than the GPOS table.

richardwb
Thank you for this. I've gone ahead and used GetKerningPair() coupled with GetGlyphIndices() and I'm now getting acceptable results. It's not correct for OpenType fonts, but that's an acceptable limitation for now.
Ali Parr
You might also want to check out Michael Kaplan's blog, he's pretty much "the uniscribe" guy at Microsoft.http://blogs.msdn.com/michkap/
Chris Haas