Closed Nielsticot closed 8 years ago
Check this out mate - http://playgroundjs.com/playground-fonts
You will need a fresh version of playground as I have just added it for your request.
Not sure if it works - I have only tested Chrome / Firefox
on Linux
Wow, that's amazing ! Thank you so much, it's just what I need ! I just tested the demo on your link and it works with Chrome on Windows & Android too. I just noticed one issue, I had to reload the page once before it works on both Android & Windows.
It is very likely that you have visited the page before and the old script from cache had to be replaced. I am terrible at caching control.
Ok, I just tested it on my Nexus 7 where I never visited the playgroundjs doc and it works perfectly, thank you again !
Also note that web fonts are quite annoying subject - they often don't work for no good reason. So if you run into such case don't get frustrated, just download another font. Sometimes using online converter like this one helps to "repair" font http://www.fontsquirrel.com/tools/webfont-generator
I just tried to load a font in my game but when I do it, I get the error Cannot read property 'insertRule' of undefined
at playground.js:1668
, I think it's because I don't have a stylesheet.
Edit: I just added <style></style>
to my index.html, it works fine.
Thanks for pointing that out - I was pretty sure that there's always at least one stylesheet that comes from browser defaults. Will find out some solution
I was having the same problem as @Nielsticot, but also noticed another issue. I do have a CSS file being referenced, but it's in a directory called css/. The fonts I load are then trying to be loaded from css/fonts/, which is not where my fonts folder is. To get around this, I tried using the paths setting for fonts in my setup, but that didn't work.
Pushed new version. Instead of using document.styleSheets
I now simply create an empty <style>
element and use it for loading fonts. That should resolve both of your problems. I would be thankful for a test.
Fix confirmed for me. Thanks!
Hi, I don't know if it's the right place to ask but is it possible to add a loader for local fonts ?