When drawing italicized text in canvas, Firefox would render them as normal for fonts like Impact
.
var ctx = canvas.getContext('2d');
ctx.font = "italic 40px Impact";
ctx.fillText("Impact", 0, 40);
Firefox
Chrome
Any ideas how to solve this?
When drawing italicized text in canvas, Firefox would render them as normal for fonts like Impact
.
var ctx = canvas.getContext('2d');
ctx.font = "italic 40px Impact";
ctx.fillText("Impact", 0, 40);
Firefox
Chrome
Any ideas how to solve this?
This is because Impact doesn't come with an italic version. You can see this when you view it in a font viewer (like Mac Font Book). Browsers fake the italics on fonts that don't have it, but Firefox is not yet faking it in the canvas. If you try a font that has italics, like Arial, it works in the canvas.
There's some discussion about this here: Italic doesn't work on all fonts in Firefox
ctx.font = "italic 40px Arial";