阿拉伯语中的斜体文本 - JavaFX

Italic text in Arabic - JavaFX

我在将文本设为阿拉伯文本的斜体时遇到问题, 这是行不通的, 我也尝试了不同类型的字体,但其中 none 有效, 这是代码:

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.scene.text.Text;
import javafx.stage.Stage;


public class JavafxApp extends Application {

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

    @Override
    public void start(Stage primaryStage) {
        var pane = new AnchorPane();
        var text = new Text("عربي English");
        text.setLayoutX(50);
        text.setLayoutY(100);
        text.setStyle("-fx-font-style: italic; -fx-font-size: 18; -fx-font- 
        family : Simplified Arabic;");
        pane.getChildren().add(text);
        var scene = new Scene(pane, 200, 200);
        primaryStage.setScene(scene);
        primaryStage.show();

    }
}

result,

有什么建议吗?我将不胜感激

你的问题是,很可能你的 windows 字体文件夹中没有斜体版本的字体,因为 JavaFX 不支持在没有该样式的字体时合成粗体或斜体字体存在

查看长期RFE: JDK-8091064 & JDK-8130526

简单地说,这意味着您需要在字体系列中使用斜体