#19 piddlePIL-doesn't support non-ascii characters

open
None
5
2000-12-10
2000-12-10
No

drawString and stringWidth don't support non-ASCII characters. The
pilfonts apparently contain everything from ISO-Latin-1, but the
metrics.dat file doesn't. Would it be possible to extend it? How is
it generated anyway?

sample program:

import piddlePIL

canvas = piddlePIL.PILCanvas(size = (100, 100))
canvas.drawString("\0344", 40, 40) # draw an a umlaut (ä)
canvas.save("ppm")

exception:

Traceback (innermost last):
File "bug-nonascii.py", line 4, in ?
canvas.drawString("\0344", 40, 40) # draw an a umlaut (ä)
File "../cvs/piddle/piddlePIL.py", line 321, in drawString
tempsize = self.stringWidth(s, font) * 1.2
File "../cvs/piddle/piddlePIL.py", line 172, in stringWidth
out = out + map[c]
KeyError:

Discussion

  • michal wallace
    michal wallace
    2005-09-25

    Logged In: YES
    user_id=1971

    Next Action:

    duplicate the bug with current piddle/sping/PIL