"Christian Stapfer" <nob...@nowhere.nil> schrieb im Newsbeitrag news:b7256$4bf516e1$544ba447$20...@news.hispeed.ch...
Here's an interesting little problem: I am given a master.ttf font file and a subset file subset.ttf of that font, and I am asked to map indices of all the glyphs in subset.ttf to the corresponding indices in master.ttf. The subset font file is the result of a pipeline of 3 tools (pdflatex, Adobe Reader, and the Microsoft XPS Document Writer).

<snip/>

So my next best idea is to draw the various glyphs as, 16x16 B/W images, say, and use the 16*16 bits (that is, 16 ints or 8 longs) that result from this as a sufficiently precise description of the glyph to do the necessary comparisons.

PIL would be great for this, except for one "little" problem: I need to be able to draw glyphs based on their index, not based on their character code.

Any ideas to get around that limitation of PIL's drawing primitives?

To answer my own question: I might parse the cmap table of the ttf file, and then invert that mapping char->index. I think that's going to be the next approach that I will try.

Regards,
Christian


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to