Remix.run Logo
lewisjoe 2 hours ago

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.

madeofpalk 2 hours ago | parent | next [-]

> how is this different from Skia-wasm

It’s not wasm?

lewisjoe 2 hours ago | parent | prev [-]

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