This issue came out during the code review https://github.com/openjdk/jfx/pull/1157 (JDK-8306083)
When a Tex node embedded in TextFlow is scaled using -fx-scale-x, the glyph rendering gets affected and Text nodes gets overlapped as shown in the screenshots.
CaretShape, preferredWidth, or hitInfo are not affected by changing the scale.
Run the following program to reproduce the issue.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;
import javafx.stage.Stage;
public class TextFlowSample extends Application {
TextFlow control = new TextFlow();
@Override
public void start(Stage primaryStage) throws Exception {
Node[] ts = createTextArray();
control.getChildren().addAll(ts);
VBox root = new VBox(control);
Scene scene = new Scene(root, 400, 600);
primaryStage.setScene(scene);
primaryStage.show();
}
protected static Text t(String text, String style) {
Text t = new Text(text);
t.setStyle(style);
t.setFont(new Font(48));
return t;
}
protected Node[] createTextArray() {
return new Node[] {
t("BOLD ", "-fx-font-weight:bold;"),
t("BOLD ", "-fx-font-weight:100; -fx-scale-x:200%;"),
t("BOLD ", "-fx-font-weight:bold;"),
};
}
public static void main(String[] args) {
launch();
}
}
---------- END SOURCE ----------
When a Tex node embedded in TextFlow is scaled using -fx-scale-x, the glyph rendering gets affected and Text nodes gets overlapped as shown in the screenshots.
CaretShape, preferredWidth, or hitInfo are not affected by changing the scale.
Run the following program to reproduce the issue.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;
import javafx.stage.Stage;
public class TextFlowSample extends Application {
TextFlow control = new TextFlow();
@Override
public void start(Stage primaryStage) throws Exception {
Node[] ts = createTextArray();
control.getChildren().addAll(ts);
VBox root = new VBox(control);
Scene scene = new Scene(root, 400, 600);
primaryStage.setScene(scene);
primaryStage.show();
}
protected static Text t(String text, String style) {
Text t = new Text(text);
t.setStyle(style);
t.setFont(new Font(48));
return t;
}
protected Node[] createTextArray() {
return new Node[] {
t("BOLD ", "-fx-font-weight:bold;"),
t("BOLD ", "-fx-font-weight:100; -fx-scale-x:200%;"),
t("BOLD ", "-fx-font-weight:bold;"),
};
}
public static void main(String[] args) {
launch();
}
}
---------- END SOURCE ----------