-
-
Notifications
You must be signed in to change notification settings - Fork 268
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
JPackage'd app has font issue #580
Comments
I looked into this a little deeper, the base font on which the default font is created seems to have a wrong size in this situation, FlatLaf.java line 581:
This starts returning a font with size 24. I don't know why the look and feel is initialized again here. I also just did a test with OpenJDK-19+36-RC1-beta and I haven't been able to reproduce the problem yet, so maybe it already got fixed. |
How long is it necessary to let the laptop sleep? |
On my system I was able to reproduce it almost every time by pressing the power button and waking it up again by pressing the space bar after 5 - 10 seconds. |
I also just tested on a Windows 11 system with 150% scale (Surface Go 2), here the OpenJDK-17 JPackage'd app also shows a larger text after sleeping (text size 18), the OpenJDK-19 version still seems ok. If you want I can upload a zip and mail you a link. |
Yes, that would be great. Send link to What OpenJDK distro do you use? Adoptium, Zulu, etc? |
I just sent you a mail with a download link. I am also using the Adoptium distro (I downloaded the .zip from adoptium.net) |
…isabling automatic UI update when system font changes (issue #580)
Thanks for the app download. Still don't see the effect on sleep-wakeup, but it also occurs when changing various UI related options in Windows Settings app. E.g. text size, accent color, cleartype on/off, always show scrollbars on/off, transparency effects on/off, etc. Since Java updates its desktop properties when it receives WM_SETTINGCHANGE message, I assume that all those options send that message. FlatLaf listens to changes of desktop property FlatLaf also listens to desktop property There is no way to disable this in FlatLaf 2.4 and earlier.
Or in Java code: System.setProperty( "flatlaf.updateUIOnSystemFontChange", "false" ); However this is not a solution for this issue. The strange thing is that this occurs only with JPackaged apps. Since JDK 19rc the issue seems to be fixed. Looked at the history of changes in jpackage since Java 18, but did not find any related commit: https://github.com/openjdk/jdk/tree/master/src/jdk.jpackage |
BTW logging can be enabled to see what desktop properties are changed. Create a log config file (e.g. handlers= java.util.logging.FileHandler
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.FileHandler.pattern = platform-log.txt
java.util.logging.SimpleFormatter.format=%5$s%6$s%n
sun.awt.windows.WDesktopProperties.level = FINE And enable it with java option:
When running JPackage'd app and compare log of startup with log after disabling ClearType, there are a lot of differences, which are all scaling related (BTW log produced with 150% scaling): For comparison, app started with java.exe has only a single difference (ClearType disabled): |
Thanks, that's a lot of interesting information! I've also been looking around for commits/bugs that could explain why JDK19 is ok, but couldn't find anything either. All I can see is that the desktop properties from your screenshot are retrieved in using the winapi function I agree that having FlatLaf update the UI when the font changes is a good idea, and the new option to turn it off so we can work around jpackage/jdk bugs is a very nice solution! Thanks for all your great work! |
I was curious how java handles dpi-awareness on windows and had another look, as far as I can tell it is declared in manifest in the .exe, after un-7zipping the .exe's off the different JPackage'd apps I noticed the JDK19 version has a manifest but the JDK17 version does not. I found the following bug report: "jpackage.exe" creates application launcher without Windows Application Manfiest I still don't understand how this can cause the scale to be ok first and wrong later, but I think this might be the one we were looking for. |
Closed because this is not a FlatLaf issue, and fixed since JDK19. |
I want to switch to JPackage for distributing my apps, everything seemed ok until my laptop had been sleeping for a while, after waking it up all texts are twice as large (can be reproduced).
I only see this happening when using FlatLaf (tested default laf and nimbus).
Before sleeping:
After sleeping:
I created a small program for testing this
The jar was built with maven and I used the following JPackage command to create the app-image:
I am running windows 10 on a surface book 3, hidpi scaled 200%, and tested with FlatLaf 2.4, OpenJDK 17.0.4
The text was updated successfully, but these errors were encountered: