Closed xcfdszzr closed 2 years ago
The reason why font is blurry on the decorated frame vs undecorated one is that different font antialiasing technique is being used. Blurry one is a grayscale antialias (default Swing implementation):
The crisp one is a subpixel font antialias (native implementation):
Unfortunately this is a known JDK issue - subpixel font antialias simply doesn't work on non-opaque destinations, which non-opaque window is. You can check this issue for more details: #130
There are some potential workarounds for this that can maybe be done in WebLaF, but so far I didn't find an optimal way to implement them without having some major drawbacks for performance or usability.
I could suggest a couple of options to avoid this issue:
Avoid using custom window decoration on native windows as there are plenty of known issues with non-native window decoration in any L&F such as this font issue, window behavior, window animations missing etc. You are also taking a performance hit due to the way window is being rendered in non-opaque state.
Use custom decoration, but avoid using non-opaque windows, only rectangular-shaped non-opaque windows, this unfortunately would mean that you can't have a fancy rounded window shape or shadow painted around it (unless there is a native shadow provided by OS, for instance in Mac OS X).
Find a custom font for your application that will "play nicely" with grayscale antialias. I don't really have any particular recommendations, but you can definitely find fonts that render well when used with grayscale antialias. Although I'm not sure if that only applies to English or not, that is something that needs further testing. Fonts can be replaced globally via static fields in WebLookAndFeel.java.
Unfortunately neither of these solves the problem, these are all workarounds until we either get a better support for subpixel antialias in JDK, or I find a way to workaround it within the library.
Generally it's been a while since the last time I've looked into this issue, so I'll try to find some time and peek at possible solutions again - maybe there are some new developments on that front, or maybe I've missed something.
@mgarin
Dear author, can you provide a custom label component to handle this, or can a higher JDK handle this problem?
Anxious processing font this problem, online anxious waiting process.....
Unfortunately I don't have any solution for this right now. Also as far as I know - higher JDK versions have the same issue.
@mgarin
I am so sad about this question, but thank you for your answer. Please inform me if there is any future plan
I recommend you to subscribe for #130 notifications, I'll be posting updates there once there will be any. Will be closing this issue for now as a duplicate.
Dear author, how should I handle this problem, online urgent waiting
issus : The same font is blurred by shape