问题
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,
回答1:
OpenType fonts have two different ways to specify kerning information, both of which are optional:
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.
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.
来源:https://stackoverflow.com/questions/1253928/extracting-glyph-kerning-information-c