-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
bpo-31500: IDLE: Scale default fonts on HiDPI displays. #3639
Conversation
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.
If you are intending to get this in the upcoming releases, do what you think best as long as Appveyor passes. I will be in bed until after the cutoffs.
Lib/idlelib/util.py
Outdated
| 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']) |
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.
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.
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.
IDLE currently replaces negative sizes with 10. Should the size be negated instead?
Perhaps.
It seems to me that the bug should be fixed in tkinter.font. Do you think that people are depending on the bug?
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 fix_scaling to run.py.
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.
Lib/idlelib/filelist.py
Outdated
|
|
||
| def _test(): | ||
| from idlelib.editor import fixwordbreaks | ||
| from idlelib.util import fix_scaling |
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.
|
|
I was about to ask, how to we avoid enlarging the fonts when they should not be enlarged, as on Cheryl's system. How did you pick 1.2? On my system, with a 27" 2560 x 1440 widescreen, which I believe is not 'HiDPI', it is 1.333. In my display settings, I selected "Enlarge fonts...: 125%". I don't know if that affect tk's reported scaling factor. How about adding On some Linux systems, the reported size of at least TkFixedFont is 0. See bpo-26673, which changed the GetFont line 'if size < 0' to '<= 0'. Do you have any such thing on your machine? What does the following show? For me: |
|
I created #3664 to immediately remove the dialog size, so I can more forward with other patches that would require it to be revised or removed. I will adjust this one once it is merged. |
|
Merge 223caaa includes the size removal. |
|
On Ubuntu: |
This is arbitrary.
On Windows all sizes are positive, isn't? They are not changed.
The same as @csabella. |
|
run.py already imports sys , so it seems somewhat sensible to avoid the useless loop on windows, but this is not critical. I will presume that the current patch works fine on your machine. I decided not to worry for now about any monitors or systems that lie about the scaling. That is a bug on someone else's part. |
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 2.7, 3.6. |
…GH-3639) (cherry picked from commit a96c96f)
|
GH-3686 is a backport of this pull request to the 3.6 branch. |
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 2.7. |
|
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
|
GH-6585 is a backport of this pull request to the 2.7 branch. |
https://bugs.python.org/issue31500