You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
kind of missing the rest of the code that sets up the font object here. Also, did you do some debugging yourself to see what was in "font" on that third line? Does it have a fontFamily assigned? does the console show an error or warning? Is the fon't your trying to load actually called what you use as construction string, etc?
Ok, i've found the problem. The fontFamily = 'A.C.M.E. Secret Agent' and it's illegal name to set to ctx.font. It's works when I change the font family to 'SecretAgent'.
ah, yes for family names with special characters, you need to extra-quote the family name. That gets weird, so it's always a good idea to use a font name without spaces or special characters when using the Font object.
I tried this code to draw on canvas but no result:
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.font="30px "+font.fontFamily;
ctx.fillText("Hello World", 10, 50);
The text was updated successfully, but these errors were encountered: