Tk Source Code

View Ticket
Login
Ticket UUID: 0917069c05e9c354a27c8105a7a22264090b9274
Title: tk on HDPI displays renders tiny fonts
Type: Bug Version: 8.5.15 and 8.6.1
Submitter: anonymous Created on: 2014-05-31 20:48:06
Subsystem: 46. Unix Fonts Assigned To: nobody
Priority: 7 High Severity: Minor
Status: Open Last Modified: 2023-08-09 17:27:00
Resolution: None Closed By: nobody
    Closed on:
Description:
I'm trying to run tk application (tkabber) on High DPI display (236 DPI in my case) under Linux. tk seems to be DPI unaware in this aspect since it renders fonts in tiny sizes like this:

http://ixion.pld-linux.org/~arekm/tkabber-tiny-fonts.jpg

(look at menus, writting text area - these are tiny and unconfigurable in tkabber; fortunately roster and main window area have fonts configurable, so I increased these there should be no need to do that)

Anyway tk should be DPI aware and render fonts properly according to DPI. Right now we have a situation where using the same tk application on different machines (laptops) will give us unusable results in some cases.

From #tcl irc:
21:47 <@ijchain> <schelte> The sources say: "Font size specified in pixels on X11, not points. This is Theoretically Wrong, but in practice works better; using points leads to 
                 huge inconsistencies across different servers."
21:48 <@ijchain> <schelte> It looks like it is now also "Wrong in practice" and should possibly be reconsidered.
User Comments: kjnash added on 2023-08-09 17:27:00:
Tiny fonts when specified in pixels on a high-dpi display are likely an example of the more general bug [1de3a48312].

dkf added on 2014-06-03 08:25:23:

Tk has a scaling mechanism (see tk scaling for the script-level exposure) but at least historically it was wildly wrong due to displays having massively incorrect information. We also should consider the fact that different screens on one “display” (i.e., one Xserver instance) can have different DPIs.

Dealing with icons and other images is going to be far worse, as is the fact that lots of Tk widgets have fixed pixel widths for various things (e.g., the amount that a button appears to depress).