Closed gmcgath closed 9 years ago
The solution is described in a Stack Overflow item which I submitted, then was able to answer thanks to a comment which pointed me in the right direction:
https://stackoverflow.com/questions/30059731/font-name-being-misparsed-in-canvas/30064626#30064626
I saved the "font" from Google to css/fonts.css. The font is actually a small bit of CSS with a URL that points at the font data. In fonts.css, I changed the font family from "Slabo 27px" to "Slabo" and removed the link to the Google font. In the database I made the corresponding change to the font name.
It's probably a win that the user will see the font as Slabo rather than Slabo 27px.
There's still an odd problem that the first time I change the font, it comes up as generic serif rather than Slabo. The second time it always works. I'll look into this.
The Slabo 27px font always displays at a small fixed size. Fabric.js is passing the typeface name to Canvas's font property, which parses the name as CSS and assumes that "27px" is a font size.