I’m using a custom font defined by @font-face to draw text on a canvas:
context.font = “12px MyFont”;
context.fillText(text, 20, 20);
Apparently the call to fillText is executed before the font is loaded, so it falls back to some standard font instead.
Some remedies are suggested in
http://stackoverflow.com/questions/2756575/drawing-text-to-canvas-with-font-face-does-not-work-at-the-first-time
- adding an extra element before the canvas doesn’t work for me
- using a timer solves the problem, but that seems a ugly (and how long should one wait?)
Any suggestions on how to cope with this in Ionic (2)?