Hacker News new | past | comments | ask | show | jobs | submit login

> if it were up to me, I'd just skip it and render everything inside a <canvas/>

That's very tempting, but you lose a lot if you do that, especially around text:

* Accessibility for screen readers, etc.

* The easy ability to select text, copy/paste between other apps, etc.

* Line splitting

* Support for multiple languages, RTL, and all their other rendering quirks.

Canvas has some text APIs, but they are fairly rudimentary. It's a hard problem.




> Canvas has some text APIs, but they are fairly rudimentary

That's an understatement for sure. `measureText` is not even close to feature parity with where windows apis were 25 years ago.

Or something like text underlines has to be done entirely manually.


I completely agree, and these are required features for a full app that is planning to reach the world.

It requires a lot of extra work, but real world apps like Figma [0] are rendering directly to the canvas, and frameworks like Flutter offer support for canvas rendering (via Skia's CanvasKit) [1] [2].

I guess my point is that if someone is using WASM to ditch JavaScript, why stop there? Ditch the DOM and CSS too! Render all of the graphics with OpenGl or WebGPU!

There is a class of applications that I want to explore that would be better suited to by doing just that. I don't believe every app should do that, just that for what I want to build, that's where I'm looking at going (hence my "if it were up to me" comment above).

[0] https://www.figma.com/blog/building-a-professional-design-to...

[1] https://docs.flutter.dev/platform-integration/web/renderers

[2] https://skia.org/docs/user/modules/canvaskit/




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: