Hi Paul, On 11/6/06, Paul Barrett <[EMAIL PROTECTED]> wrote: > The ft2font module provides a Python interface to the FT2Font C API. > get_charmap is one of the methods in this API as is set_charmap. A > font can have multiple character maps.
Ok. > get_charmap() returns the default one. Others can be specified > by providing an argument to get_charmap(). To add a new charmap > to the font, you must first find out what charmaps it contains, > so get_charmap is needed for this. I disagree. Method FT2Font::get_charmap doesn't return the list of available character maps; it returns a dictionary mapping glyph indices to character codes in the *current character map*. You wrote "other character maps can be specified by providing an argument to get_charmap", but method FT2Font::get_charmap doesn't accept any parameter (I looked at line 1208 of file ft2font.cpp). > In addition, changing this method to return the reverse mapping would > violate the rule of least surprise. Yes, but in my opinion, this is the current solution that violates "the rule of least surprise". Method FT2Font::get_charmap calls two important methods of FreeType: FT_Get_First_Char and FT_Get_Next_Char. These two methods are used to parse all character codes from first to last in the current character map, and returning corresponding glyphs. You can read those methods description and an example at this URL: http://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#FT_Get_First_Char Reading this example, it seems apparent the "least surprising solution" is a mapping from character codes to glyph indices, doesn't it? > Note that creating the reverse dict is easy in Python. Yep, it's why we love programming in Python! ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel