Re:Text Rendering Hates You
by sings on Monday June 26, 2023 @09:10AM
(#36479246)
Sounds like a use case for soft hyphens. If you don’t mind where the words break, you could sprinkle soft hyphens through the text to get it to break more often than the default renderer would otherwise.
[ Parent
| on HN ]
Re:Text Rendering Hates You
by chrismorgan on Monday June 26, 2023 @09:12AM
(#36479268)
Soft hyphens are no use in this case, because browsers take them as a break opportunity of equal standing with a space. In my experience, liberal sprinkling on soft hyphens makes things worse, not better, because you end up with loads of gratuitous hyphens. What’s needed is a different algorithm for breaking paragraphs into lines, something better than the greedy algorithm that all browsers use. Something like Knuth-Plass, which applies a penalty to hyphens so that it’ll use them if the alternatives are bad enough, but won’t be too eager about using them.
Re:Text Rendering Hates You
by DonHopkins on Monday June 26, 2023 @09:50AM
(#36479648)
Supple hyphens, then?
I definitely agree that soft hyphens are a simplistic workaround if used in the way I suggested, and are indeed inferior to a complex and well-thought out hyphenation system. Still, if someone is considering `word-wrap: break-word;` for narrow table columns, soft hyphens are worth knowing about.