Enable normal fonts?
Would it be possible to enable non-bitmap fonts in text?
I know it’s possible for canvas, but I haven’t looked into your implementation:
https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Drawing_text
I have always wanted to try making a game where the "sprites" are emoji!
Kaboom rendering is based on WebGL, using truetype / opentype fonts in WebGL requires bit of a hustle and probably need external dependencies to parse them. I also would really like to have them but unfortunately it's not the biggest priority at the moment, will definitely support in the future.
Okay, retro is cool too ;)
Thanks for understanding!
(note to myself) Did a bit of research and this might be an easier implementation that can be done in near future:
- use
FontFaceAPI to load the font - draw the font on a global offscreen
<canvas>with 2d ctx - use that offscreen 2d canvas as a WebGL texture and draw it
- clear offscreen canvas, redraw, and update texture (stored on each
text()comp) on text change
It's implemented on master and kaboom@next, see new examples/text.ts