javafxports / openjdk-jfx

The openjfx repo has moved to:
https://github.com/openjdk/jfx
GNU General Public License v2.0
1.01k stars 145 forks source link

Text not scaled on HiDPI screen #600

Open Exlll opened 4 years ago

Exlll commented 4 years ago

I use Debian 10 (Buster) with JDK 13. The text is displayed very small on my screen.

Screenshot from 2019-09-22 14-37-04

public final class App extends Application {
    @Override
    public void start(Stage stage) throws Exception {
        var primary = Screen.getPrimary();
        var javaVersion = System.getProperty("java.runtime.version");

        System.out.println("DPI: " + primary.getDpi()); // output: 282.0
        System.out.println("VERSION: " + javaVersion);  // output: 13+33

        Text message = new Text("Hello JavaFX!");
        message.setFont(Font.font(20));

        VBox root = new VBox();
        root.getChildren().add(new Label("Hello World!"));
        root.getChildren().add(new Button("Click me!"));
        root.getChildren().add(message);

        Scene scene = new Scene(root, 300, 100);
        stage.setScene(scene);
        stage.show();
    }
}
kevinrushforth commented 4 years ago

This GitHub issue tracker is not actively tracked or managed. Please file a bug at bugreport.java.com.

Bio7 commented 4 years ago

I already filed a bug report related to this bug, see:

https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8233181

Exlll commented 4 years ago

I found the following workaround which at least works on my system: Passing -Dglass.gtk.uiScale=2.0 as an option to the JVM as described here https://wiki.archlinux.org/index.php/HiDPI#Java_applications.