|
From: Evgeniy S. <eug...@gm...> - 2007-02-14 20:21:49
|
On Wednesday 14 February 2007 21:53, Nicolas Grilly wrote: > On 2/14/07, Evgeniy Stepanov <eug...@gm...> wrote: > > FT2Font.get_charmap() returns a mapping from glyph index to character > > code. This looks like a very bad design decision to me, because several > > character codes can correspond to one glyph. For example, in Times New > > Roman, both 0x32 (space) and 0xA0 (nbsp) are mapped to glyph index 3. Of > > course, the first one gets lost in get_charmap(). > > > > I think, get_charmap should be fixed to return mapping from character > > codes to glyph indices. Alternatively, get_charmap() could be left as it > > is, and get_rcharmap() added. > > I agree with you. I've already posted something about this issue some > time ago: http://sourceforge.net/mailarchive/message.php?msg_id=37418828 > > > I'm willing to implement either one. Which do you prefer ? > > I think we should prefer the first alternative: I've made a quick grep > through matplotlib's code and I've observed that each time get_charmap > is called, the returned dict is never used as is, but immediately > reversed. I also prefer the first way. Here is the patch. Please re-check at least the changes to mathtext.py, I could miss something. mathtext_demo.py still works, but it obviously does not test all the changes. |