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

I don't have the same background, but it drives me nuts when I see phrases word-wrapped on awkward boundaries that don't make sense (especially in h1 elements, titles, headers, billboards, posters, etc etc etc).

I'm just going to re-emphasize what you wrote because it's exactly the problem and I want to change the formatting a bit to make it clearer. In the article, the author shows that the headline with text-wrap:balance would look like this

    One year on and what
  next for remote working?
, which breaks right in the middle of "what next". Much better (to my eyes) is wrapping the line along some larger syntactic boundary:

  One year on and what next
     for remote working?
We have the technology to analyze sentences and figure out the syntactic structure. Preferring to break those sentences across larger parts of the syntax tree would make this text-wrapping property so much better.


Thanks for the illustration!

I suppose the technology for more accurate automated line breaks should indeed be already available, though I don’t think it’ll be applied in this particular case quite soon so we’ll have to endure some awkward (even if a bit less ugly now with text-wrap: balance) word wrapping in meantime.


ChatGPT can do it. Perhaps this won't be viable in-browser for a while, but I could see somebody using it in a static site build pipeline to convert space characters to   at compile-time.

---

Break the following headlines up into individual strings where each string is an idiom that shouldn't be broken up. If words aren't part of an idiom, they can be their own string.

"One year on, and what's next for remote workers?"

"Hurricane Ida Gives New York What For!"

"Ice Town Costs Ice Clown His Town Crown"

---

"One year on" "and" "what's next" "for" "remote workers?"

"Hurricane Ida" "Gives" "New York" "What For!"

"Ice Town" "Costs" "Ice Clown" "His" "Town Crown"


> ChatGPT can do it.

This is truly the kind of suggestion that makes me wonder about the energy efficiency of websites.

To me it seems, that many web developers/designers are so happy with the fact that what they are doing actually works, they often forget other (more boring?) considerations like stability, maintainability, resilience, efficiency and such.

We have a LEGO set with infinite pieces and a good website in my eyes doesn't try to use as many as possible of those, but to use just as many as needed while still getting what you aim for.


Additional thought: The problem space of how to break a specific text depending on the size of a window is sort of limited as well. So if someone had the idea to solve this using machine learning, the best idea would be to run these calculations once (per page, serverside), and then just use a lookup table or something of the sorts after. Just store the line break positions for each text on the page for all possible widths that make sense and check that table when rendering.

This has the advantage that a human typesetter could output to this format as well or they could correct the machine generated output.

As there is a limited number of ways to break text the table wouldn't even have to store all pixel widths, just those at which the words break differently.


I think it needs to be done while the browser is flowing text, because it should look good with nearly any width, like:

  Ice Town Costs Renowned Ice Clown His Town Crown
                     and Gown
vs

  Ice Town Costs Renowned Ice Clown
      His Town Crown and Gown


Thanks for expanding on my point. Yes, LLMs or plain algorithms, the capability is here. It just won’t be used for this.


I've long been bugged by the lazy approach to plurals/multiples in e.g. game tooltips. "You loot 861 gold(s)" I wonder if we'll ever see improvements on either front.


It's even more complicated when you try and localize this. Some languages make pluralization very complicated.

A few years ago, one of the localization team members gave me a tip I have been trying to stick to this time around.

Instead of "You found 1 coin." or "You found 2 coins." you turn it into an enumeration "Coins Found: 1"

The localization of the string part is the same for all languages.




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

Search: