-
Notifications
You must be signed in to change notification settings - Fork 150
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
Calculate Scaling for Font without Device#getDPI() #1802
Conversation
79d387b
to
79f50d5
Compare
c7f8c08
to
e789f41
Compare
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java
Show resolved
Hide resolved
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.
FWIW I tested this in Mac and it doesn't produce any regressions. See vi-eclipse/Eclipse-Platform#159 (comment)
This commit solves two interconneted issues. Wrong layouting when text is printed and wrongly scaled fonts for printing. Device#getDPI returns values for Display and Printer that lead to wrong assumption using getDPI e.g. in the ScalingSWTFontRegistry. Printing text is broken because Printer DPI (e.g. 600) is way different from the Monitor DPI (96) that lead to inconsistent Font behavior in the different scenarios. Now font scaling is utilizing the zoom level instead of DPI in relavant scenarios.
e789f41
to
fbc1b3a
Compare
...les/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java
Show resolved
Hide resolved
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.
The code looks fine and my previous test (on Mac) was green. I can't test on my Mac at the moment since I'm at the office, but once it's tested then this PR is good to go on my account.
FTR I'm talking about testing the very last change (https://github.com/eclipse-platform/eclipse.platform.swt/compare/e789f41c2192b54821d6315a47324aab475b0683..fbc1b3a140d1f78049f6b18c39a3ce0e32c2553a) on Mac |
getDPI always returns points for primary monitor and can produce faulty behavior. Printing the code is broken because Printer DPI (400) is different from the Monitor DPI (100). Now we compute points from the zoom level instead of currentFontDPI.
How to Test
Before Fix
After Fix