I have a problem making the text italic to the Arabic texts, It does not work, I also tried different types of fonts, but none of them works, Here is the code:
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();
}
}
Any suggestions? I would be grateful
Your issue is, most probably you don't have an ITALIC version of your font in your windows fonts folder, Because JavaFX does not have support for synthesizing bold or italic fonts when no font of that style is present
See long-standing RFE: JDK-8091064 & JDK-8130526
Simply That means you need to have italic font in your font family