freetypy.Face.get_char_variant_index

Face.get_char_variant_index()

Get the glyph id of a char code as modified by the variant selector.

Parameters:
  • charcode (int) – The char code point in Unicode.
  • variantSelector (int) – The Unicode code point of the variation selector.
Returns:

glyph_index – The glyph index. 0 means either ‘undefined char code’, or ‘undefined selector code’, or ‘no variation selector cmap subtable’, or ‘current CharMap is not Unicode’.

Return type:

int

Notes

If you use FreeType to manipulate the contents of font files directly, be aware that the glyph index returned by this function doesn’t always correspond to the internal indices used within the file. This is done to ensure that value 0 always corresponds to the ‘missing glyph’.

This function is only meaningful if a) the font has a variation selector cmap sub table, and b) the current charmap has a Unicode encoding.