Pixi.js: unreliable font

Created on 10 Dec 2016  ·  3Comments  ·  Source: pixijs/pixi.js

sometimes the google font loads and sometimes it doesn't. I have tried loading the font in the HTML, CSS, as well as the JS. The only one that really worked was the CSS but as I said, when I refresh, sometimes it shows up and sometimes it doesn't.

🤔 Question

Most helpful comment

I use and find https://github.com/bramstein/fontfaceobserver good for font loading.

All 3 comments

This sounds like a loading race-condition. I suspect that you're trying to render text in PIXI when the font hasn't completed loading yet.

One suggestion would be to use the document.font.load API? Currently, it has limited browser support, but helpful for preloading fonts: https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/load

Hope that helps.

I use and find https://github.com/bramstein/fontfaceobserver good for font loading.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sntiagomoreno picture sntiagomoreno  ·  3Comments

readygosports picture readygosports  ·  3Comments

Darker picture Darker  ·  3Comments

st3v0 picture st3v0  ·  3Comments

Vardner picture Vardner  ·  3Comments