Did you know you can make text wrap around a circle? Did you know you can do it efficiently, if you take the time to write 7,500 tests across 12 languages and 3 browsers?
Pretext has been floating around the web recently, a new zero-dependency library from Cheng Lou. Because this thing is awesome.
Text layout on the web is expensive. You have to go through the DOM. But it turns out the problem, if you decompose it, is just math. Measure the words (or things like words, word pieces), cache the widths, do arithmetic on top. 15 kilobytes, zero dependencies.
But figuring out the right algorithm would take a million years on human time. You're not going to work through the Great Gatsby, Rashomon, Arabic poetry, and Thai folk tales to make sure your line-breaking handles every context. You're not going to manually validate CJK kinsoku shori rules, or Arabic no-space punctuation clusters, or Myanmar medial glue. Nobody has time to grind through 25 categories of Unicode edge cases across 12 languages.
Except AI.
If you read through the Pretext GitHub repo, you can see the methodology in the commit history. A CLAUDE.md in the first commit, before any algorithm code. The human architect defines the constraints: layout() is arithmetic-only, never touches the DOM. Here's how you measure. Here's how you iterate. Here's the test suite. Go.
Then the grind. Commit by commit, accuracy ticks up like a leaderboard. (This uses Pretext. Drag the orbs around.)
Each commit is a hypothesis, tested against three browsers, scored, kept or reverted. 271 commits over 27 days until every test passes. 100% accuracy.
I think the lesson is that it takes the human design of a problem, and the clear-sightedness to know what an elegant solution might be. Then you set AI loose, hill climbing and grinding the problem to dust. Not throwing compute at something dumb because it seems cool. Pointed at a real problem with a real finish line.
One person and one AI, solving a web-scale problem for everyone. Text layout on the web was never a design element. Maybe now it is.