This is more complex issue. Font description can be not only a tuple, but also a string like "TkTextFont -21 bold". It can also be in other format, like "-adobe-avant garde gothic-book-o-normal--0-0-0-0-p-0-iso8859-1".
The problem is that some font subcommants support font description, while others only font name. The Font class tries to provide object oriented interface for this, and by default creates a new font from a file description. Then the name of this font instead of the original font description is used in font actual, font measure and font metrics. There is a loss of precision between font actual and font create.
Addressed by #152025 and #153267. There are two parts to this:
A font description (a tuple like ("Calibri", -14) or a string) is expanded via Tcl's font actual, which resolves a size in pixels to points. This is inherent — a description can't be parsed into options otherwise. To use a description without loss of precision, wrap it with exists=True (gh-143990: Allow tkinter.font.Font to wrap a font description #152025): Font(root, ("Calibri", -14), exists=True) renders identically to the raw tuple.
Activity
pythongh-143990: Preserve negative pixel sizes in tkinter.font.Font
pythongh-143990: Preserve negative pixel sizes in tkinter.font.Font
pythongh-143990: Preserve negative pixel sizes in tkinter.font.Font
serhiy-storchaka commented on Jan 20, 2026
This is more complex issue. Font description can be not only a tuple, but also a string like "TkTextFont -21 bold". It can also be in other format, like "-adobe-avant garde gothic-book-o-normal--0-0-0-0-p-0-iso8859-1".
The problem is that some font subcommants support font description, while others only font name. The Font class tries to provide object oriented interface for this, and by default creates a new font from a file description. Then the name of this font instead of the original font description is used in font actual, font measure and font metrics. There is a loss of precision between font actual and font create.
pythongh-143990: Add What's New entry for tkinter.font.Font wrapping
serhiy-storchaka commented on Jun 23, 2026
#152025 allows to wrap a font description, not only a named font.
gh-143990: Allow tkinter.font.Font to wrap a font description (GH-152025
serhiy-storchaka commented on Jul 7, 2026
Addressed by #152025 and #153267. There are two parts to this:
So a Font built from a bare description still reports the resolved size by design, with exists=True as the exact-preservation path.
pythongh-143990: Preserve the size when creating a Font from a named …
Merge branch 'main' into pythongh-143990-font-configure
encukou commented on Jul 8, 2026
The Alpine buildbot is broken, likely because of this change. See e.g. https://buildbot.python.org/#/builders/301/builds/15551
gh-143990: Preserve the size when creating a Font from a named font (G…
serhiy-storchaka commented on Jul 8, 2026
encukou commented on Jul 8, 2026
serhiy-storchaka commented on Jul 8, 2026
Should be fixed by #153322.
gh-143990: Do not assume the requested font size in test_font (GH-153322
pythongh-143990: Fix the 3.15 backport of pythonGH-153267
pythongh-143990: Drop a redundant comment in the 3.15 backport
[3.15] gh-143990: Preserve the size when creating a Font from a named…
[3.13] gh-143990: Preserve the size when creating a Font from a named…
[3.14] gh-143990: Preserve the size when creating a Font from a named…