Justifying Text-Wrap: Pretty
matklad.github.io
matklad.github.io
I don't know why we're still obsessed with right justification? In 1450 it made a lot of sense to try to squeeze the most text on a page, but today it isn't?
Justify is not only useless but it's also responsible for creating all those white spaces of various length, which are annoying enough by themselves, but which can also create "rivers" which become an incredible distraction.
The first thing I do with a new ebook is to modify it in Calibre so that it's left-align instead of justify.
Maybe "pretty" is a solution, but non-justify is simpler, and readily available.
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.
I am not a typographer, and I’ve never used it in a professional capacity, but v1.6 (early 2024) improved Scribus a lot. I’ve used it and liked it for some personal projects for years, but the improved typography in 1.6 is big.
I am not gonna argue if they are correct or not but the reality i've experienced is that at minimum socially the printing industry is married to InDesign.
Hyphenation will probably lead to people thinking the content is generated by AI, which would be a significant downside for most websites. Users want to believe the site creator put effort in (regardless of whether they did or even if it's appropriate to have done.)
The article shows it in the example screenshots, but does not explicitly mention it or how it interacts with the different options discussed
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.
> Incipit epistola sancti iheronimi ad paulinum presbiterum de omnibus divine historie libris capitulum primum.
I'm not entirely up on all the abbreviations and and shorthand used in medieval manuscripts, but the macron over the final ū in 'capitulū' indicates the vowel being nasalized, which often happens before the final 'm' consonant which in this case is suspended. The 'pmū' is similar, but also I think a contraction or abbreviation for primum. With all these tricks available to the scribes it's no wonder they can make the right edge look nice.
Veni venti Gucci!
I guess it’s safe to say that you can read Latin? What I’m trying to figure out is whether the typography in the Gutenberg Bible was exceptional for its time.
So I guess the fairer question may be whether Germans would’ve found Latin difficult to read in blackletter/Gothic type, which apparently descends from Roman cursive anyhow.
I asked my initial question (whether the grandparent commenter understood the language) because I wanted to figure out whether criticizing the typography as “form-over-function” made sense.
Thanks.
Anyway, it's the Gutenberg bible. The epistle of St. Jerome, according to the alt text.
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...
Unfortunately there's no live HTML demo to inspect, just the images.
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?
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...
So hyphenation exists in theory, but I'm just going to go ahead and say that however it's tuned seems completely broken.
1. Fixed layout isn't gonna cut it
2. Justification isn't that important anyways
To anyone who came of age on the internet in the last three decades justified text just looks strange. I say that coming from the typography nerd camp. No matter if we like it or not, in the end flush left and flush right has lost and it will not come back regardless what browsers implement.
> WebKit devs, you are awesome for shipping this feature ahead of everyone else...
Um, no? Chrome shipped this feature in 2023: https://developer.chrome.com/blog/css-text-wrap-pretty
Safari isn't early shipping this, they're late. Though not as late as Firefox, admittedly.
In Safari, it’s a very different look.
Caniuse claims it's supported in Chrome: https://caniuse.com/mdn-css_properties_text-wrap_pretty
But you're right, it very clearly isn't working.
Is it a regression? Did it break and nobody noticed?
> Although Safari is the first browser to ship a non-joke implementation of text-wrap
(Emphasis mine.) Chrome is using a different algorithm for this, which probably fixes some typographic problems, but defaults to greed most of the time.
Edit: finally found it, see cousin comment.
"While support for pretty shipped in Chrome 117, Edge 177, and Opera 103 in Fall 2023, and Samsung Internet 24 in 2024, the Chromium version is more limited in what it accomplishes. According to an article by the Chrome team, Chromium only makes adjustments to the last four lines of a paragraph. It’s focused on preventing short last lines. It also adjusts hyphenation if consecutive hyphenated lines appear at the end of a paragraph."
The article goes on to talk about how it's up to the browser (and not necessarily permanent) about how to handle the setting, and furthermore a new value was agreed upon to do what Chromium was doing, called "text-wrap: avoid-short-last-lines".
Here's the article on what the Chromium version does: https://developer.chrome.com/blog/css-text-wrap-pretty/
So it does exist... but yeah, barely does anything. Thank you for finding the explanation!
One less gripe out html I guess. Still a few hundred left.
I can already see when browsers implement the TeX microtypography package, everyone starts using it and everyone will be annoyed how slow browsers, html and js are.