A DESCRIPTION OF THE PROBLEM :
If you insert a new Text node with no text property set, in between existing Text nodes, then the first character of the existing text node just after the new inserted one, is rendered with font of newly entered Text node.
Problem can simply be reproduced with following code:
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;
import javafx.stage.Stage;
public class TextFlowBug extends Application {
@Override
public void start(Stage stage) throws Exception {
StackPane root = new StackPane();
Scene scene = new Scene(root,700,400);
stage.setScene(scene);
stage.show();
TextFlow textFlow = new TextFlow();
textFlow.setMaxSize(200,200);
textFlow.setBorder(new Border(new BorderStroke(Color.DARKGRAY, BorderStrokeStyle.SOLID,null, BorderWidths.DEFAULT)));
Text t1 = new Text("Text1");
Text t2 = new Text("Text2");
Text t3 = new Text();
t3.setFont(Font.font(42));
Text t4 = new Text("Text4");
textFlow.getChildren().addAll(t1,t2,t3,t4);
root.getChildren().addAll(textFlow);
}
}
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Just create a new java class file 'TextFlowBug' and run the provided source code:
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expected result is a single default font for the whole text
ACTUAL -
'T' of 'Text4' appears with 42 font size.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;
import javafx.stage.Stage;
public class TextFlowBug extends Application {
@Override
public void start(Stage stage) throws Exception {
StackPane root = new StackPane();
Scene scene = new Scene(root,700,400);
stage.setScene(scene);
stage.show();
TextFlow textFlow = new TextFlow();
textFlow.setMaxSize(200,200);
textFlow.setBorder(new Border(new BorderStroke(Color.DARKGRAY, BorderStrokeStyle.SOLID,null, BorderWidths.DEFAULT)));
Text t1 = new Text("Text1");
Text t2 = new Text("Text2");
Text t3 = new Text();
t3.setFont(Font.font(42));
Text t4 = new Text("Text4");
textFlow.getChildren().addAll(t1,t2,t3,t4);
root.getChildren().addAll(textFlow);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
If you insert a Text node with 'new Text(" ")' - a one character length whitespace, the problem do not show up
FREQUENCY : always
If you insert a new Text node with no text property set, in between existing Text nodes, then the first character of the existing text node just after the new inserted one, is rendered with font of newly entered Text node.
Problem can simply be reproduced with following code:
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;
import javafx.stage.Stage;
public class TextFlowBug extends Application {
@Override
public void start(Stage stage) throws Exception {
StackPane root = new StackPane();
Scene scene = new Scene(root,700,400);
stage.setScene(scene);
stage.show();
TextFlow textFlow = new TextFlow();
textFlow.setMaxSize(200,200);
textFlow.setBorder(new Border(new BorderStroke(Color.DARKGRAY, BorderStrokeStyle.SOLID,null, BorderWidths.DEFAULT)));
Text t1 = new Text("Text1");
Text t2 = new Text("Text2");
Text t3 = new Text();
t3.setFont(Font.font(42));
Text t4 = new Text("Text4");
textFlow.getChildren().addAll(t1,t2,t3,t4);
root.getChildren().addAll(textFlow);
}
}
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Just create a new java class file 'TextFlowBug' and run the provided source code:
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expected result is a single default font for the whole text
ACTUAL -
'T' of 'Text4' appears with 42 font size.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;
import javafx.stage.Stage;
public class TextFlowBug extends Application {
@Override
public void start(Stage stage) throws Exception {
StackPane root = new StackPane();
Scene scene = new Scene(root,700,400);
stage.setScene(scene);
stage.show();
TextFlow textFlow = new TextFlow();
textFlow.setMaxSize(200,200);
textFlow.setBorder(new Border(new BorderStroke(Color.DARKGRAY, BorderStrokeStyle.SOLID,null, BorderWidths.DEFAULT)));
Text t1 = new Text("Text1");
Text t2 = new Text("Text2");
Text t3 = new Text();
t3.setFont(Font.font(42));
Text t4 = new Text("Text4");
textFlow.getChildren().addAll(t1,t2,t3,t4);
root.getChildren().addAll(textFlow);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
If you insert a Text node with 'new Text(" ")' - a one character length whitespace, the problem do not show up
FREQUENCY : always