lightning-js / blits

The Lightning 3 App Development Framework
https://blits-demo.lightningjs.io/
Apache License 2.0
71 stars 14 forks source link

Rendering mode on Canvas, still tries to load SDF fonts #172

Closed promentol closed 2 months ago

promentol commented 2 months ago

when setting renderMode to 'canvas', and deleting all sdf fonts, it still tries to load SDF fonts, and throws error

Blits.Launch(App, 'app', {
  w: 1920,
  h: 1080,
  multithreaded: false,
  debugLevel: 1,
  reactivityMode: 'Proxy',
  renderMode: 'canvas',
  keymap: keymapping(),
  fonts: [
    { family: 'opensans', type: 'web', file: 'fonts/OpenSans-Medium.ttf' },
  ],
  canvasColor: 'transparent',
  viewportMargin: 100,
})

After debugging, inside renderer fontEngines is [class SdfTextRenderer, class CanvasTextRenderer]

There are many devices which don't support webgl but support canvas, like PS5, or FireTV stick version, canvas rendering is essential.

Thanks

promentol commented 2 months ago

Here is screenshot of stack trace

Screenshot 2024-10-01 at 5 20 37 PM
michielvandergeest commented 2 months ago

hey @promentol, good catch! Thanks for reporting this. I can indeed reproduce it, and can confirm this is a bug. We should be able to make a fix for this shortly.

promentol commented 2 months ago

@michielvandergeest thank you for commenting

I already made pull request which fix it. While it is a small change, it is easy to reproduce, just render with canvas instead of webgl, and it will throw this error.

https://github.com/lightning-js/blits/pull/173

michielvandergeest commented 2 months ago

Het @promentol, thanks a lot. That looks pretty much like the approach I was gonna take.

I'll do some due diligence testing, but this looks good. So you can expect this fix in the next release.

Thanks again

michielvandergeest commented 2 months ago

Released in 1.5.0