Hi, I know font rendering has been discussed a lot already on this forum but I don't want to talk about sharpness of text but very strange effects of glyph positioning.
The program below switches between 1 and 2 text-nodes which results in strange effects at least on my OS-X box. With a font size 15 you see the 2nd text shifting a bit to the right now you could explain this with rounding but it gets even more interesting if you make the font size 25 suddenly the F is changing its position! I recorded a video showing the behavior on my system at http://efxclipse.bestsolution.at/ScreenFlow.mp4 My questions are: a) does that happen on other OSes as well b) does anyone have an idea where I could start searching c) do you think this can be fixed? > package application; > > > import javafx.application.Application; > import javafx.scene.Node; > import javafx.scene.Scene; > import javafx.scene.control.Button; > import javafx.scene.control.TextField; > 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 TestMe extends Application { > > private TextField fontSize; > private TextField text; > > @Override > public void start(Stage primaryStage) throws Exception { > VBox b = new VBox(); > > text = new TextField("ABCDEF"); > b.getChildren().add(text); > > fontSize = new TextField("15"); > b.getChildren().add(fontSize); > > TextFlow f = new TextFlow(createText(text.getText())); > > b.getChildren().add(f); > Button bu = new Button("Split text"); > bu.setOnAction((e) -> { > if( f.getChildren().size() == 1 ) { > int l = text.getText().length() / 2; > > > f.getChildren().setAll(createText(text.getText().substring(0, > l)),createText(text.getText().substring(l))); > bu.setText("One Text"); > } else { > > f.getChildren().setAll(createText(text.getText())); > bu.setText("Split text"); > } > }); > b.getChildren().add(bu); > > Scene s = new Scene(b); > > s.getStylesheets().add(TestMe.class.getResource("application.css").toExternalForm()); > primaryStage.setScene(s); > primaryStage.show(); > } > > private Node createText(String text) { > Text t = new Text(text); > // t.setSmooth(false); > t.setFont(Font.font(Integer.parseInt(fontSize.getText()))); > return t; > } > > public static void main(String[] args) { > Application.launch(args); > } > } Tom -- Thomas Schindl, CTO BestSolution.at EDV Systemhaus GmbH Eduard-Bodem-Gasse 5-7, A-6020 Innsbruck http://www.bestsolution.at/ Reg. Nr. FN 222302s am Firmenbuchgericht Innsbruck