Justifying Text-Wrap: Pretty

(matklad.github.io)

50 points | by surprisetalk 5 days ago ago

6 comments

  • eviks 5 minutes ago

    > We are getting closer and closer to the cutting-edge XV-century technology. Beautiful paragraphs!

    While the broader point is fine, the example to me is just bad to me: very narrow column with a lot of hyphens and identical width/no variety making it harder to anchor your eye (though colored letters are awesome and play this role)

    Ok, bad rag is bad, but the ancient text goes overboard in the other direction. This looks close to the form-over-function vibe.

  • notpushkin 13 minutes ago

    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.

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

    • crazygringo 6 minutes ago

      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.

  • albert_e 22 minutes ago

    Are hypens no longer acceptable?

    There is no mention of it in the post. If words (in any language) can be arbitrarily long and columns can be arbitrarily narrow, we will need to solve for this anyway.

    Even without those extremes, I feel that there will always be place for the good old hypen when displaying or printing text for the main purpose of readability. No need to max out on perfect "look" in every application of text.

    In fact in many places one might even find columns with jagged right edges more readable -- letting you visually distinguish each line from the one above/below it easily by length alone -- and may even lend a certain aesthetic character that is the opposite of mechanical / boring / machine produced / sterile.

    Of course not negating the need for a well implemented method without bugs to justify text correctly when the use case demands it.

    • ameliaquining 12 minutes ago

      Auto-hyphenation is part of what text-wrap: pretty does.