[Image-SIG] TrueType fonts under PIL

Joachim Thöne rijoth at gmx.de
Tue Feb 13 13:48:00 CET 2007


goat at tirfa.com schrieb:
> I have been writing a python script that automatically makes button  
> images from text files and I have some questions about the TrueType  
> font rendering in PIL 1.1.6 under Python 2.5 under Win32 (used the  
> installer).
>
> I have been having some issues with glyphs either not rendering  
> completely or not rendering at all(the ones that I have noticed are  
> '_' and the descender (http://en.wikipedia.org/wiki/Descender) for  
> lower case 'g'). After some playing around, I found that this seems to  
> be mostly dependent on font size. Depending on which font I use, the  
> size at which everything renders correctly changes but they render  
> correctly at some sizes and don't when I use other sizes.
>
> Does anyone have any suggestions on what I can do to improve TrueType  
> font rendering without changing the font size?
>
> Thanks for your time,
>
> Tim
>
> Environment Information:
> Windows XP SP2
> Python 2.5 (.msi version from python.org)
> PIL 1.1.6 (downloaded .msi for python 2.5)
>
> Font: I've tried several, but the one that I have been using most is  
> IPA Mona Gothic (ipag-mona.ttf) which is a Japanese language font  
> available from http://www.geocities.jp/ipa_mona/ and I believe that it  
> is used in several FOSS projects.
> _______________________________________________
> Image-SIG maillist  -  Image-SIG at python.org
> http://mail.python.org/mailman/listinfo/image-sig
>
>   
Hello Tim,
I've loaded ipag-mona.ttf fontfile into PIL via the aggdraw library (an 
extension for Pil, that does not use PIL to load the font) with an 
identical result to yours. Migtht be that the fontfile is buggy, I've 
never had troubles with displaying .ttf fonts in PIL.

Joachim



More information about the Image-SIG mailing list