1

When I run the program, the words are written in incomprehensible letters and font. I tried to use: scene.getRoot().setStyle("-fx-font-family: 'serif'"); but it didn't help

CoreText note: Client requested name ".SFNS-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:]

public class Main extends Application {
    @Override
    public void start(Stage stage) throws IOException {
        FXMLLoader fxmlLoader = new FXMLLoader(Main.class.getResource("mainwindow.fxml"));
        Scene scene = new Scene(fxmlLoader.load(), 900, 500);
        stage.setTitle("Todo List");
        scene.getRoot().setStyle("-fx-font-family: 'serif'");
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch();
    }

    @Override
    public void stop() throws Exception {
        try {
            TodoData.getInstance().storeTodoItems();
        } catch (IOException e) {
            System.out.println(e.getMessage());
        }
    }

    @Override
    public void init() throws Exception {
        try {
            TodoData.getInstance().loadTdoItems();
        } catch (IOException e) {
            System.out.println(e.getMessage());
        }
    }
}

Here is an example of the incomprehensible font:

Bad font

skomisa
  • 16,436
  • 7
  • 61
  • 102
looney
  • 11
  • 2
  • 1
    Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Feb 25 '22 at 15:52
  • The duplicates indicate that garbled display of some fonts was an issue with some older versions of JavaFX (e.g. some versions of JavaFX 11) on some Macs. Use the most recent stable OS (macOS 12 Monterey) and JavaFX/JDK versions (17.0.2+). – jewelsea Feb 25 '22 at 20:12
  • 1
    If you continue to have issues, you must supply a [mcve] for debugging assistance, as well as full environment info (Hardware/OS/JDK/JavaFX versions used). – jewelsea Feb 25 '22 at 20:18

0 Answers0