[Image-SIG] ImageFont family mojibake

Donn donn.ingle at gmail.com
Mon Sep 14 08:29:31 CEST 2009


(Reposted to image-sig: I sent it to python-list by mistake.)
Python 2.6
PIL Version: 1.1.6-3ubuntu1              
libfreetype6 Version: 2.3.9-4ubuntu0.1

Hello,
I have a feeling I've asked this in the distant past, but it's recently 
emerged as a bug in my app so can anyone point me in the right direction?

In Fonty Python, when I draw the family name of a font some* are mojibake in 
the form: ????s??? etc. The string is drawn to a DC with 
wxPython, but is fetched from the font via ImageFont, like so:

f=ImageFont.truetype("FGTshgyo.TTF",1,encoding="utf-8")
print f.font.family
'?????s????'

So, the string is plain (not unicode) and wrong from the get-go.

*"some" being those fonts that contain family names not in western encodings. 
The sample font that demonstrates the problem and was sent to me to test is 
called: BGPENKB.TTF another is FGTshgyo.TTF
These are substantial files and I can't attach them to a list. if you need them 
for testing I can send them to another email address, or upload them 
somewhere.

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).

Any assistance would not go amiss.
\d
-- 
home: http://otherwise.relics.co.za/
2D vector animation : https://savannah.nongnu.org/projects/things/
Font manager : https://savannah.nongnu.org/projects/fontypython/


More information about the Image-SIG mailing list