freetypefreetype2

How to get available Glyph ranges in a font using FreeType lib API


I need to get ranges of the available glyphs in a given font file/face.

The brute force of iterating cp in 0..65535, calling FT_Get_Char_Index(cp), and checking for 0 result seems wrong, both because Unicode code point could be more than u16, and because it seems wasteful.

Is there any "iteration" API?


Solution

  • The functions FT_Get_First_Char and FT_Get_Next_Char can be used to parse all character codes available in a given charmap.

    There is an example at FT_Get_First_Char.