Playing with the Knuth-Plass algorithm and I think it’s an interesting algorithm to visualize!
Damar
Visit on X@damarberlari2.5K followers
173,170 views
Playing with the Knuth-Plass algorithm and I think it’s an interesting algorithm to visualize!
Might write a complete visual article later, but here’s a quick comparison for now.
It looks at the whole paragraph to find the breakpoints that produce the most uniform spacing.
So unlike the greedy approach, the layout might shift when a new word is added.
Note: I didn’t use pretext here; it’s a monospace font so calculating the word widths is quite easy. will try pretext and try other fonts next
Comments
Comments from the original post on X (Twitter)
No comments yet
