Problem with giant font sizes in tkinter

Arndt Roger Schneider arndt.roger at addcom.de
Fri Feb 11 14:30:52 CET 2011


Steven D'Aprano schrieb:
> On Thu, 10 Feb 2011 15:48:47 +0000, Cousin Stanley wrote:
> 
> 
>>Steven D'Aprano wrote:
>>
>>
>>>I have a tkinter application under Python 2.6 which is shows text in a
>>>giant font, about twenty(?) times larger than expected.
>>>
>>>The fonts are set using:
>>>
>>>titlefont = '-Adobe-Helvetica-Bold-R-Normal-*-180-*' 
>>>buttonfont = '-Adobe-Helvetica-Bold-R-Normal-*-140-*' 
>>>labelfont = '-Adobe-Helvetica-Bold-R-Normal-*-140-*' 
>>>....
>>
>>  Although I've been a linux user for several years, that type of font
>>  spec hurts my head .... :-)
>>
>>  Will the more simplistic type of tuple spec not work in your tkinter
>>  application ?
> 
> 
> I don't know, but I'll give it a try.
> 
> Nevertheless, I'd like to learn how to diagnose these sorts of font 
> issues. Can anyone suggest where I should start?
> 
> 
> 

Those adobe helveticas are bitmap fonts.
Tk 8.5 uses freetype to render fonts under X11,
if you wish to use outdated bitmap fonts under X11,
then disable-xft when building Tk 8.5.

I do assume there are different tk versions on your
various platforms, and the troubling one is with
version 8.5 --8.5 uses anti-aliasing hence freetype.

Recommendation: Get rid of bitmap fonts under X11.

BTW the default fonts under Linux are:
bitstream vera sans (for helvetica)
bitstream vera (for times)
and bitstream vera sans mono (for courier).

In my opion those bitstream fonts are much better
than the mentioned Adobe fonts.

-roger







More information about the Python-list mailing list