switch from GDK_SCALE to J2D_UISCALE in netbeans launcher script for linux
Description
Re: #7780
Conditions: HiDPI, Linux, X11
When a program is developed in NB, that invokes a X program, the invoked program will inherit the GDK_SCALE environment variable, set by the netbeans launcher script. The effect will be 4x scaling in the invoked program.
Consider using J2D_UISCALE as a replacement for GDK_SCALE in the launcher script.
See also #7780 for a part of the discussion.
Use case/motivation
To improve the fontscaling workaround used in launcher script.
Related issues
#7780 #6185
Are you willing to submit a pull request?
Yes
It is clear, the GDK_SCALE setting is interpreted differently by the JDK vs the X programs. Unclear is, since when, and until. OpenJDK21 running on stock Ubuntu-mate 24.04 with HiDPI, will not scale the fonts correctly (and 22.02 also didnt without tweaking).
Ideally the JDK needs to use the same algorithm as the other X11 programs. I'm not sure if behavior of X11 programs has changed recently, my most recent scaling problems occured when upgrading from Ubuntu 22.04 to 24.04, and starting over with a fresh environment/profile.
Taking https://github.com/apache/netbeans/issues/7780#issuecomment-2657192464 in consideration, the launcher should not touch the environment if one or both of the GDK_SCALE and J2D_UISCALE is set.
Does Java treat GDK_SCALE and J2D_UISCALE the same? Seems so from https://github.com/apache/netbeans/issues/7780#issuecomment-2366983468 , right?
There is also sun.java2d.uiScale=2 . Is it the same thing?
Taking https://github.com/apache/netbeans/issues/7780#issuecomment-2657192464 in consideration, the launcher should not touch the environment if one or both of the GDK_SCALE and J2D_UISCALE is set.
That would make sense, I think.