-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
8, jfx25
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
Rendering stroked text with StrokeType.OUTSIDE remains extremely slow, leading to high CPU usage, UI lag, and complete unresponsiveness, especially with multiple text instances. This longstanding issue (related to JDK-8089081) persists in recent JDK versions, crippling applications that rely on outlined text for accessibility or visual design.
In my commercial application (basically a text-slide-presenter) app I desperately need StrokeType.OUTSIDE on the Text because my client strongly dislikes the default StrokeType.CENTERED behaviour. However the app becomes completely unusable and unresponsive when this stroke-type is applied. This isn't just "slow"—it's a showstopper for production apps.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Render multiple javafx.scene.text.Text nodes (e.g in a scrollpane). Set the stroke type of the texts to "outside": text.setStrokeType(StrokeType.OUTSIDE).
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Smooth scrolling and rendering, comparable to StrokeType.CENTERED.
ACTUAL -
Immediate lag on scroll init; freezes after 2–3 pans with >10 labels. CPU-bound on render thread.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.StrokeType;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class StrokeLagDemo extends Application {
@Override
public void start(Stage stage) {
VBox vbox = new VBox(5);
for (int i = 0; i < 50; i++) { // Simulate list; lag worsens with count
Text text = new Text("Dynamic Text Item " + i + " - Scroll to reproduce lag");
text.setFill(Color.WHITE);
text.setStroke(Color.GRAY);
text.setStrokeWidth(1.0);
text.setFont(Font.font(16));
text.setStrokeType(StrokeType.OUTSIDE); // triggers bug
vbox.getChildren().add(text);
}
ScrollPane scroll = new ScrollPane(vbox);
scroll.setPrefSize(400, 300);
Scene scene = new Scene(scroll);
stage.setScene(scene);
stage.setTitle("StrokeType.OUTSIDE Lag Demo");
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
---------- END SOURCE ----------
Rendering stroked text with StrokeType.OUTSIDE remains extremely slow, leading to high CPU usage, UI lag, and complete unresponsiveness, especially with multiple text instances. This longstanding issue (related to JDK-8089081) persists in recent JDK versions, crippling applications that rely on outlined text for accessibility or visual design.
In my commercial application (basically a text-slide-presenter) app I desperately need StrokeType.OUTSIDE on the Text because my client strongly dislikes the default StrokeType.CENTERED behaviour. However the app becomes completely unusable and unresponsive when this stroke-type is applied. This isn't just "slow"—it's a showstopper for production apps.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Render multiple javafx.scene.text.Text nodes (e.g in a scrollpane). Set the stroke type of the texts to "outside": text.setStrokeType(StrokeType.OUTSIDE).
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Smooth scrolling and rendering, comparable to StrokeType.CENTERED.
ACTUAL -
Immediate lag on scroll init; freezes after 2–3 pans with >10 labels. CPU-bound on render thread.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.StrokeType;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class StrokeLagDemo extends Application {
@Override
public void start(Stage stage) {
VBox vbox = new VBox(5);
for (int i = 0; i < 50; i++) { // Simulate list; lag worsens with count
Text text = new Text("Dynamic Text Item " + i + " - Scroll to reproduce lag");
text.setFill(Color.WHITE);
text.setStroke(Color.GRAY);
text.setStrokeWidth(1.0);
text.setFont(Font.font(16));
text.setStrokeType(StrokeType.OUTSIDE); // triggers bug
vbox.getChildren().add(text);
}
ScrollPane scroll = new ScrollPane(vbox);
scroll.setPrefSize(400, 300);
Scene scene = new Scene(scroll);
stage.setScene(scene);
stage.setTitle("StrokeType.OUTSIDE Lag Demo");
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
---------- END SOURCE ----------
- duplicates
-
JDK-8089081 Rendering stroked text with StrokeType of INNER or OUTER is very slow
-
- Open
-
- relates to
-
JDK-8236838 StrokeType.OUTSIDE causes lag when used on a label inside a ScrollPane
-
- Closed
-