Tk Source Code

View Ticket
Login
Ticket UUID: 1544491
Title: should NOT ignore the XLFD_AVERAGE_WIDTH for scalable fonts
Type: Bug Version: None
Submitter: dizzi Created on: 2006-08-22 11:07:55
Subsystem: 46. Unix Fonts Assigned To: kennykb
Priority: 5 Medium Severity:
Status: Pending Last Modified: 2026-09-28 16:27:56
Resolution: Out of Date Closed By:
    Closed on:
Description:
In TkFontParseXLFD() in generic/tkFont.c I read:

    /* XLFD_AVERAGE_WIDTH ignored. */

However it happens that sometimes the X server returns
bogus font names with non zero XLFD_PIXEL_SIZE and
XLFD_AVERAGE_WIDTH=0 which correspond to scalable fonts.
This can confuse Tk when it ranks fonts for choosing
the one closest to a desired specification.

A font with XLFD_PIXEL_SIZE != 0 and XLFD_AVERAGE_WIDTH
== 0 is not a true fixed size font as suggested by
pixel size but a bogus font generated by the X server
for a scalable font. This font should be treated as
scalable font by Tk and pxlsz should be forced to 0 in
TkFontParseXLFD().

For a detailed description of the problem and a patch see:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=156119
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=156115
User Comments: serhiy.storchaka added on 2026-09-28 16:27:56:

This only affects the X11 core fonts (Tk configured with --disable-xft, in 9.1 also --disable-bidi). The current X.Org server lists such names (non-zero pixel size and average width 0) only if the pattern contains the size, but Tk lists the fonts of the family with any size, and gets the scalable fonts with size 0. So with 8.6 and 9.1 the font selection is the same with and without the patch. Debian dropped the patch long ago too, it is not in the tk8.5 and tk8.6 packages.

If it still happens, please tell which X server or font server lists such names.


kennykb added on 2006-10-18 23:01:15:
Logged In: YES 
user_id=99768

jenglish, indeed it does relate.  Thanks for the pointer.

jenglish added on 2006-10-18 10:39:06:
Logged In: YES 
user_id=68433

kbk, is this related to what you're working on?