Re: [csswg-drafts] [css-text-4] Hyphenate only overflowing words?

It might be useful to let this behavior emerge by simply using an extreme value for a sort of "hyphens-aggressiveness" property. Right now `hyphens: auto` is super aggressive: it seems to hyphenate whenever there's enough room for merely the first syllable of a word. If it were possible to do something like `hyphens: auto; hyphens-aggressiveness: 0.5;` to get roughly half as much hyphenation (i.e., only hyphenate where there's room for the first _two_ syllables -- or whenever container overflow would occur), that would be quite nice. The other extremes would be `hyphens: auto; hyphens-aggressiveness: 0;` (i.e., only whenever container overflow would occur) and `hyphens: auto; hyphens-aggressiveness: 1;` (i.e., equivalent to not setting `hyphens-aggressiveness` at all -- the current behavior).

TL;DR: Why only offer extremes when we could offer a continuous gradient?

With the extreme overflow-only behavior (aggressiveness of 0) you'd get this:
```
 -------------
|The most     |
|extraordinar-|
|y thing.     |
 -------------
```
There, the gap at the end of line 1 is quite large (just as we see whenever hyphenation is disabled). To a person desiring an "overflow-avoidance-only" hyphenation scheme, that gap is what you're looking for. But it has a disastrous effect because line 3 has just a tiny sliver of a word!

With the current behavior (aggressiveness of 1) you'd get this:
```
 -------------
|The most ex- |
|traordinary  |
|thing.       |
 -------------
```
There, the gap at the end of line 1 is minimized to the fullest extent, and the line ends with just a tiny sliver of a word! (See the pattern there?)

With a nice medium aggressiveness (say, any value around 0.3-0.7), you get this:
```
 -------------
|The most     |
|extraordi-   |
|nary thing.  |
 -------------
```
In that last example, even though "nar-" could fit on line 2, the lower aggressiveness causes it to concede a bit more gap on line 1 in exchange for avoiding orphaning the very short "y" -- this is nice typesetting.

I can think of 2 quite distinct algorithms for achieving medium aggressiveness:

1. Strive to hyphenate only near the center of a word (similar number of syllables before and after the hyphen).
2. Hyphenate only when not doing so would cause an end-of-line gap is more than n% of the line width.

Lower values would err toward allowing larger end-of-line gaps (syllabic balance), while higher values would err toward encouraging smaller gaps (syllabic imbalance).

-- 
GitHub Notification of comment by yeahforbes
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/616#issuecomment-329822741 using your GitHub account

Received on Friday, 15 September 2017 15:53:07 UTC