<AWT Dev> Why no fractional scale factor in AWT with X11?

Florent Lioult florent at hihan.org
Wed Nov 6 19:02:05 UTC 2019


Contrary to Windows and MacOS X, the X11 implementation of AWT on Linux 
doesn't use a floating scale factor internally. For instance, setting 
the Gnome desktop property 
'org.gnome.desktop.interface/text-scaling-factor' to 2.2 will produce a 
x2.0 transform for a Swing application.

I've had a look into the latest JDK sources (14) and the coercion to int 
seems arbitrary to me considering that both the portable layer and the 
native side rely on doubles. In fact, I've removed it without much 
changes and everything seems to work fine. Honestly, I haven't conducted 
enough tests to claim it hasn't any issues, but I didn't see blatant 
problems neither. Of course, there are a lot of resources on the net 
discussing HiDPI support with Java on various platforms and I understand 
that the scale factor could be rounded for aesthetic reasons, but I'm 
not sure it's the rational behind how the code behaves today for X11.

Is there a specific reason I ignore or is this capability just something 
nobody is interested in on Linux?

- Florent

More information about the awt-dev mailing list