|
From: Nicolas G. <nic...@ga...> - 2007-02-15 17:34:00
|
> I don't remember why we did it this way originally, or if was you or I > who did it, but if it is correct that the mapping is sometimes many > codes point to one one glyph index, but there each glyph index must > point to a single character code (the latter must be correct, right?) > then reversing it seems to be the right course. But it's been a long > time since I delved into freetype internals ... FreeType 2 documentation states very clearly that character codes are mapped to glyph indices, not the opposite. I think the mapping from glyph indices to character codes is useless, and I've not seen any use case of that in matplotlib. The page http://www.freetype.org/freetype2/docs/tutorial/step1.html says: - "A face object contains one or more tables, called charmaps, that are used to convert character codes to glyph indices." - "To convert a Unicode character code to a font glyph index, we use FT_Get_Char_Index, as in "glyph_index = FT_Get_Char_Index( face, charcode );". This will look the glyph index corresponding to the given charcode in the charmap that is currently selected for the face." The page http://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html says: - "FT_Get_First_Char: This function is used to return the first character code in the current charmap of a given face. It also returns the corresponding glyph index." - "FT_Get_Next_Char: This function is used to return the next character code in the current charmap of a given face following the value 'char_code', as well as the corresponding glyph index." Thanks, -- Nicolas |