StrokeText bug with ttf fonts


Hello, there’s a bug with stroke text that’s been in Canvas+ for a while. Stroke text is useful when you want to add edges to text, but it gets cut off for ttf fonts. I made an example of what this looks like. I used a black strokeText and then a red fillText

var canvas = document.getElementById("canvas"); var context = canvas.getContext("2d"); context.fillStyle = "white"; context.fillRect(0, 0, canvas.width, canvas.height); context.font = "96px font"; context.strokeStyle = "black"; context.lineWidth = 16; context.fillStyle = "red"; context.strokeText("Hello world", 32, 400); context.fillText("Hello world", 32, 400);

Screenshots on Android, iOS and web respectively:

The last one is how it’s supposed to look of course
On Android it gets cut off on the left and upper side, iOS on the left side.

A minimal example of reproducing this: (5.6 KB)


Already notified the person in charge of this.

Thanks for the feedback!


Was any solution found for this one?


Still have this problem. Any solution??