JDK-8123924 : Canvas: error rendering text using GraphicsContext.strokeText
Type:Bug
Component:javafx
Sub-Component:graphics
Affected Version:8
Priority:P3
Status:Closed
Resolution:Duplicate
Submitted:2013-07-10
Updated:2015-06-17
Resolved:2013-08-12
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
Joe, could you please try this on your Windows machine ? Thanks.
29-07-2013
Victor, similarly to RT-31572, this works on my machine.
could you please try this again (with my modified program) and maybe paste the output of -Dprism.debug=true here ?
Thanks
29-07-2013
Works for me on Mac and Windows
The only differences is that on Mac, the text stroke is a bit wider (note we are not using the same font on mac and win) and it is clipped half across the last character.
Also note the way you code the testcase (probably due to the sequence of commands you used to compose the scene) won't start on mac.
I reorder the code to:
@Override
public void start(Stage primaryStage) throws Exception {
final Canvas canvas = new Canvas(120, 120);
GraphicsContext _gc = canvas.getGraphicsContext2D();
// _gc.setLineWidth(1);
_gc.setFont(new Font(30));
// _gc.setTextAlign(TextAlignment.CENTER);
_gc.strokeText("Text2", 50, 60);
Pane borderPane = new VBox(canvas);
borderPane.setPrefSize(180, 190);
borderPane.setStyle("-fx-border-color: darkgray;");
Group root = new Group(borderPane);
primaryStage.setScene(new Scene(root, 300, 300));
primaryStage.show();
}