CreateJS / PreloadJS

PreloadJS makes preloading assets & getting aggregate progress events easier in JavaScript. It uses XHR2 when available, and falls back to tag-based loading when not.
http://createjs.com/
MIT License
2.87k stars 762 forks source link

[FontLoader] If font has "bold" in name, it gets truncated #259

Open djipco opened 5 years ago

djipco commented 5 years ago

When FontLoader tries to guess the name of the font, it strips the weight string from the filename. The problem is that the weight string might already be part of the font's name.

I realized this while trying to load a font called Grobold. In this case, the font-family generated by FontLoader becomes Gro. The substring bold is being stripped out.

It took me quite a while to figure this one out. The problem is with line 488. I would've submitted a PR but I'm not sure what would be the best way to fix this...

On a related note, now that there is broader support for FontFaceSet.load(), it might be better to use that and fallback to the current method when unavailable.