Search code examples
c++cwinapifonts

Windows API To Access Font Tables (Kern, GPOS, etc)


Currently Apple provides functions to access data in font tables, like CTFontCopyTable. I'm using it to parse information (kerning, etc) out of a font when available. Is there any similar way of pulling the same data on Windows per font?

I can see a lot of documentation on the windows side when it comes to these font tables, but I can't seem to find a way to pull this data per font.

Here is how I'm pulling the data in osx:

CTFontRef lCTFont = CTFontCreateWithName((CFStringRef)lNSFontName, 800.0f, NULL);
CFDataRef lKernTable = CTFontCopyTable(lCTFont, kCTFontTableKern, kCTFontTableOptionNoOptions);
CFDataRef lGPOSTable = CTFontCopyTable(lCTFont, kCTFontTableGPOS, kCTFontTableOptionNoOptions);

Solution

  • GetFontData will get the raw table data, but as other suggestions advise, you will probably want to use the system-provided text layout methods rather than trying to roll your own.