HTML5 - check if font has loaded
- by espais
At present I load my font for my game in with @font-face
For instance:
@font-face {
font-family: 'Orbitron';
src: url('res/orbitron-medium.ttf');
}
and then reference it throughout my JS implementation as such:
ctx.font = "12pt Orbitron";
where ctx is my 2d context from the canvas.
However, I notice a certain lag time while the font is downloaded to the user. Is there a way I can use a default font until it is loaded in?
Edit -
I'll expand the question, because I hadn't taken the first comment into account. What would the proper method of handling this be in the case that a user has disabled custom fonts?