Repository navigation
bpo-31500: IDLE: Scale default fonts on HiDPI displays. #3639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
a58e407
61d3d28
3c87c59
2bece79
c6db58c
223caaa
3eb0894
59847c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| def fix_scaling(root): | ||
| import tkinter.font | ||
| for name in tkinter.font.names(root): | ||
| font = tkinter.font.Font(root=root, name=name, exists=True) | ||
| font['size'] = abs(font['size']) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On Windows, this is nonsensical, but I remember that when we switched the IDLE default font to a tk default font, a year ago, there was a bug on Linux that sizes were negative. IDLE currently replaces negative sizes with 10. Should the size be negated instead? It seems to me that the bug should be fixed in tkinter.font. Do you think that people are depending on the bug? That aside, it is unclear how the function has any permanent effect after the function returns. I will have to trust that it does. I would prefer that the function be put in run.py rather than a tiny new module. Pyshell already imports objects from run.py that are needed in both. If doing so results in a circular import problem, and you want to get this in before the cuttoff times today, I can fiddle with the placement and imports later.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Perhaps.
This is a delicate topic. Specifying negative size is a feature of Tk. It can be used for example for precise positioning texts together with bitmap images or other pixel graphics. And just negating it changes visible font size unless display has 72 DPI (very rarely in current days). On a display with 100 DPI a font with size 10 is 33% larger than a font with size -10. I'll move Before merging I'm going to test changes on low-DPI display and on multi-display configuration. Would be nice to test it on OSX. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Default fonts now are scaled on HiDPI displays. |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't care about _test either way. It is old code that I do not use. I don't even know if it runs correctly.