Using Shear for pseudo-italic font
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.transform.Shear;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage stage) {
Group root = new Group();
Scene scene = new Scene(root, 600, 400);
stage.setScene(scene);
stage.setTitle("Slider Sample");
Text text = new Text("Using Shear for pseudo-italic font");
text.setX(20);
text.setY(50);
text.setFont(new Font(20));
text.getTransforms().add(new Shear(-0.35, 0));
root.getChildren().add(text);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Related examples in the same category