ImageFont family mojibake
donn.ingle at gmail.com
Sat Sep 12 11:15:32 CEST 2009
On Saturday 12 September 2009 07:55:14 Lie Ryan wrote:
> > f=ImageFont.truetype("FGTshgyo.TTF",1,encoding="utf-8")
> > print f.font.family
> > '?????s????'
> Are you sure that your terminal (Command Prompt/bash/IDLE/etc) supports
> utf-8 and that it is properly set up to display utf-8?
Fairly sure... It's konsole under Kubuntu Jaunty. My locale it utf-8. To tell
the truth I am not sure how to be sure.
OTOH - when I pass that family name string to wxPython (unicode version) to be
drawn to a DC it displays the exact same string that I see in Python's
console. So even if my console is misconfigured, the string is still looking
> print repr(f.font.family)
Same result. Also same for print unicode(...)
I wonder about the return result from f.font.family. If it was a unicode
object should I not see u"????s???" which would show that my terminal can't
draw the glyphs, but it knows it's a unicode?
Hmmm. This seems wrong.But I could be making a mistake.
> > I hope there's some simple encoding="voodoo" that might fix this. The
> > problem is, I guess, knowing *what* that voodoo is for arbitrary fonts
> > (which can come from any source).
> If all else fails, you can simply compare the byte string representation
> of the font family name.
I don't follow this. What would I compare it to?
Thanks for helping.
2D vector animation : https://savannah.nongnu.org/projects/things/
Font manager : https://savannah.nongnu.org/projects/fontypython/
More information about the Python-list