logoalt Hacker News

lewisjoetoday at 7:06 PM2 repliesview on HN

Quick overview of pretext: if you want to layout text on the web, you have to use canvas.measureText API and implement line-breaking / segmentation / RTL yourself.

Pretext makes this easier. Just pass the text and text properties (font, color, size, etc) into a pure JS API and it layouts the content into given viewport dimension.

Earlier you'll have to either use measureText or ship harbuzz to browser somehow. I guess pretext is not a technical breakthrough, just the right things assembled to make layouting as a pure JS API.

I have one question though: how is this different from Skia-wasm / Canvaskit? Skia already has sophisticated API to layout multiline text and it also is a pure algorithmic API.


Replies

lewisjoetoday at 7:08 PM

If the author is right, this is going to be huge for GUI web frameworks and for future rich text editors.

madeofpalktoday at 7:12 PM

> how is this different from Skia-wasm

It’s not wasm?