HighDPI Scaling Bug On Linux With JavaFX Interoperability With SWT (Possible Solution)

Kevin Rushforth kevin.rushforth at oracle.com
Thu Nov 14 21:54:02 UTC 2019

Btw, the direct pointer to the JBS bug is:


You're right that FXCanvas Hi-DPI support doesn't handle Linux at all.

As for building JavaFX on Ubuntu 19.10, I just did that, but needed to 
disable warnings as errors, likely due to the fact that gcc 9 is 
generating more warnings. If this is your problem, then you can 
temporarily edit buildSrc/linux.gradle and remove "-Werror" from the 
three LINUX.glass.glass*.cFlags settings.

Also, make sure that you have all of the required packages installed. See:


-- Kevin

On 11/14/2019 12:21 PM, marcel Austenfeld wrote:
> I filed this bug regarding the high dpi scaling on Linux when using the FXCanvas for SWT:
> https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8233181
> I think I found the problem in the FXCancas class whereas the Linux case is simply not handled:
> https://github.com/openjdk/jfx/blob/master/modules/javafx.swt/src/main/java/javafx/embed/swt/FXCanvas.java#L174
> https://github.com/openjdk/jfx/blob/master/modules/javafx.swt/src/main/java/javafx/embed/swt/FXCanvas.java#L240
> In both cases the scale factor for MacOSX and Windows is returned (by reflection) but not for Linux which I think i the same method as for Windows.
> Thus the scaling factor is always 1 which leads to this graphical distortion (if I set the scale with DPIUtil.setScale differently I can also cause a distortion!)
> However I was not able to built openjfx on Ubuntu 19.10 so far.
> Is there a gradle command to built the swt module only?
> @Kevin Rushforth: can you confirm that this is the cause for the bug?
> Unfortunately there is no issue tab on the Github page so I post here.

More information about the openjfx-dev mailing list