2

This question is closely related to

Is there a way to programmatically determine if a font file has a specific Unicode Glyph?

However, I am looking for a solution that does not use the Windows API. Freetype in particular looks promising, and I was wondering if anyone familiar with it could provide pointers.

Basically, I'd like to, given a font, calculate a mapping from character map to a sequence of codepoints without glyphs for that character map.

Community
  • 1
  • 1
saffsd
  • 23,742
  • 18
  • 63
  • 67

1 Answers1

3

With FreeType in particular, you may use the FT_Get_Char_Index function. This function returns a glyphID of 0 to indicate an unmapped glyph.

In more general terms: first you'd need to select a Character Mapping table (some fonts include multiple maps for different platforms or different purposes under a single platform), then build a dictionary from the explicitly-mapped glyphs, and test against that.

djangodude
  • 5,362
  • 3
  • 27
  • 39