cschear
cschear

Reputation: 379

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);

Upvotes: 1

Views: 337

Answers (3)

jeremie bergeron
jeremie bergeron

Reputation: 512

You can use IDWriteFontFace::TryGetFontTable, but, like GetFontData, you will need to parse the table.

Upvotes: 0

djangodude
djangodude

Reputation: 5690

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.

Upvotes: 2

Jerry Coffin
Jerry Coffin

Reputation: 490178

You can use GetKerningPairs to get kerning data and GetCharacterPlacement to get GPOS data.

If your real intent is to simply render some text correctly though, you might want to use Uniscribe instead.

Upvotes: 1

Related Questions