Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I’m looking at the comparison [0] and the `pretty` example is hyphenated, while greedy is not. Not sure it’s fair to compare them like that, considering we’ve had `hyphens: auto` for a while now.

Edit: it’s actually vice versa! Which I should have known because the very next paragraph says:

> But the “smart” algorithm decides to add an entire line to it, which requires inflating all the white space proportionally.

Which is exactly how the example on the right looks.

[0]: https://matklad.github.io/2026/02/14/justifying-text-wrap-pr...



That jumped out at me too... I'm not sure if they have different hyphenation properties set though, or if the greedy justified version just doesn't wind up hyphenating anywhere in this particular case?

Unfortunately there's no live HTML demo to inspect, just the images.


Just found this demo in the Safari blog post: https://cdpn.io/pen/debug/xxvoqNM


Fascinating, thank you!

Playing around with it, seems that Safari simply stops hyphenating entirely when when text-wrap is pretty, regardless of whether it's justified or not. (If you smoothly resize the browser width, it makes it pretty easy to tell if hyphens ever come up.)

Which means the image on the left seems like it might be the wrong image?

And now I wonder if text-wrap: pretty is supposed to avoid hyphenation? Are hyphens not pretty? Or is it just a partial implementation by Apple, that they haven't gotten around to supporting hyphenation for it yet?


You can get it if you carefully adjust the window width! Or there’s one example in the author’s post – the word “implementation” is hyphenated for me [1].

So it looks like the algorithm tries to minimize hyphenation, which makes sense to be honest.

[1]: https://matklad.github.io/2026/02/14/justifying-text-wrap-pr...


Ha. Oh wow. OK, I got "implementation" to hyphenate... but only once I changed the zoom level, and only for one specific exact window width. One pixel narrower or wider, and it stopped hyphenating.

So hyphenation exists in theory, but I'm just going to go ahead and say that however it's tuned seems completely broken.


Again, I think it’s very deliberate :-) Hyphenated words are slightly harder to read, so it makes sense to avoid them – maybe not as zealously, though.




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

Search: