-
Notifications
You must be signed in to change notification settings - Fork 187
Deprecate DefaultSWTFontRegistry and Completely switch to ScalingSWTFontRegistry #2212
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
Deprecate DefaultSWTFontRegistry and Completely switch to ScalingSWTFontRegistry #2212
Conversation
e0cf8ee to
99f0ab8
Compare
Test Results 545 files ±0 545 suites ±0 31m 41s ⏱️ + 1m 9s Results for commit 432847b. ± Comparison against base commit de1f3ef. This pull request removes 6 and adds 7 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
3241eaf to
aeccc6c
Compare
c3ea0da to
1553d4d
Compare
| private Font createAndCacheFont(int zoom) { | ||
| Font newFont = createFont(zoom); | ||
| customFontHandlesKeyMap.put(Font.win32_getHandle(newFont), this); | ||
| FontData clonedFontData = new FontData(newFont.getFontData()[0].toString()); |
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.
cloning FontData should be replaced with new constructors if #2128 gets merged
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.
This part is actually a fix for an issue independent of the refactoring. I would extract that one out + a separate test the checks that
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.
Raised a new PR for this #2237 , Not removing the changes in this PR as the CI runs would fail for this
1553d4d to
e84b5b4
Compare
bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/widgets/ControlWin32Tests.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/LegacySWTFontRegistry.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/SWTFontProvider.java
Outdated
Show resolved
Hide resolved
| private Font createAndCacheFont(int zoom) { | ||
| Font newFont = createFont(zoom); | ||
| customFontHandlesKeyMap.put(Font.win32_getHandle(newFont), this); | ||
| FontData clonedFontData = new FontData(newFont.getFontData()[0].toString()); |
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.
This part is actually a fix for an issue independent of the refactoring. I would extract that one out + a separate test the checks that
7e3ee0c to
99b63f0
Compare
fedejeanne
left a comment
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.
Just some minor comments
bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/widgets/ControlWin32Tests.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/widgets/ControlWin32Tests.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/widgets/ControlWin32Tests.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/SWTFontProvider.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/widgets/ControlWin32Tests.java
Show resolved
Hide resolved
99b63f0 to
df39b43
Compare
fedejeanne
left a comment
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.
@arunjose696 please add the necessary @SuppressWarnings("removal") so that the checks do not fail
1)Always use ScalingSWTFontRegistry
2)Rename DefaultSWTFontRegistry -> LegacySWTFontRegistry as this is not default anymore
3)Add a system property to use LegacySWTFontRegistry without monitor specific scaling active
4)Deprecate the LegacySWTFontRegistry(DefaultSWTFontRegistry)
df39b43 to
432847b
Compare
Have added SuppressWarnings, to usages of deprecated class(LegacySWTFontRegistry), still see the warnings, @fedejeanne is it required to add annotations elsewhere? |
fedejeanne
left a comment
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 stand corrected, the failures are unrelated and you already added the necessary @SuppressWarnings
|
This has caused warnings in I-build e.g. https://download.eclipse.org/eclipse/downloads/drops4/I20250625-0320/compilelogs/plugins/org.eclipse.swt.win32.win32.aarch64_3.131.0.v20250624-0912/test.html |
This seems to be a false positive, have added necessary @SuppressWarnings for this function, dont see any warnings appearing in IDE as well. |
|
It just occurs to me: could it be that the check is complaining about the deprecation without removal? The IDE is smart enough to know that suppressing the "removal" notices also suppresses the "deprecation" notices, but I don't know about the check. |


Summary
This PR introduces the following changes:
1)Always use ScalingSWTFontRegistry
2)Rename DefaultSWTFontRegistry -> LegacySWTFontRegistry as this is not default anymore
3)Add a system property to use LegacySWTFontRegistry without monitor specific scaling active
4)Deprecate the LegacySWTFontRegistry(DefaultSWTFontRegistry)
5)additionally the change also makes sure all fonts are cached when they are created, this is necessary to make sure the systemfonts would also be cached when they are created (this change is to fix Test_org_eclipse_swt_graphics_GC.test_setFontLorg_eclipse_swt_graphics_Font which was broken with ScalingSwtFontRegistry)
Reproduction Steps
To use the legacy font registry instead of the default scaling registry, launch the application with the following system properties:
With these flags, the LegacySWTFontRegistry will be used.
If Dswt.fontRegistry is not set or Monitorscaling is enabled(current default behaviour) , SWT will default to using ScalingSWTFontRegistry.