diff --git a/css-text-4/Overview.bs b/css-text-4/Overview.bs index dbdf0fa2e46..810e5f52037 100644 --- a/css-text-4/Overview.bs +++ b/css-text-4/Overview.bs @@ -5501,7 +5501,7 @@ Selecting How to Wrap: the 'text-wrap-style' property
 	Name: text-wrap-style
-	Value: auto | balance | stable | pretty
+	Value: auto | balance | stable | pretty | avoid-orphans
 	Initial: auto
 	Applies to: [=block containers=] hat establish an [=inline formatting context=]
 	Inherited: yes
@@ -5612,9 +5612,89 @@ Selecting How to Wrap: the 'text-wrap-style' property
 		
pretty
Specifies the UA should bias for better layout over speed, - and is expected to consider multiple lines, + and is expected to consider multiple lines when making break decisions. - Otherwise equivalent to ''text-wrap-style/auto'', + Otherwise equivalent to ''text-wrap-style/auto''. + + The user agent may among other things + attempt to avoid excessively short last lines, + similarly to ''avoid-orphans'', + but it should also improve the layout in additional ways. + The precise set of improvements is user agent dependent, + and may include things such as: + reducing the variation in length between lines; + avoiding typographic rivers; + prioritizing different classes of [=soft wrap opportunities=], [=hyphenation opportunities=], or [=justification opportunities=]; + avoiding hyphenation on too many consecutive lines… + +
+ The necessary computations may be expensive, + especially when applied to large amounts of text. + Authors are encouraged to assess the impact on performance + when using ''text-wrap-style: pretty'', + and possibly use it selectively where it matters most. +
+ +
avoid-orphans +
+ Specifies the UA should avoid excessively short last lines, + and is expected to consider more than one line + when making break decisions + (for example, to avoid "fixing" an orphan + by making the previous line too short). + The user agent may decide against improving the last line + when it would make some prior line(s) substantially unbalanced. + The user agent should not attempt to improve other aspects of the layout + beyond what ''text-wrap-style/auto'' + if those improvements come at a significant performance cost. + + Note: In western typography, an “orphan” can refer to a single word on the last line of a paragraph. + However, not all languages or writing systems wrap lines at word boundaries, + and even in languages that do, + a few very short words on the last line may still be undesirable, + especially if the available inline space is long. + This specification does not therefore strictly define + lines to be too short only when they are composed a single word, + and lets the user agent be the judge of what is excessively short. + + Note: See also the 'orphans' property for control over fragmentation + and the other typographic meaning of “orphans”. + +
+ For instance, with the given line length, the following test would be wrapped with a single word on the last line, + which could be judged too short. +
+ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα
+πολλὰ πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον
+ἔπερσεν.
+				
+ Applying ''text-wrap-style: avoid-orphans'' could yield something like this instead, + which is arguably more pleasing: +
+ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς
+μάλα πολλὰ πλάγχθη, ἐπεὶ Τροίης ἱερὸν
+πτολίεθρον ἔπερσεν.
+				
+
+
+ However, the following fragment is more vexing: +
+Circumnavigating
+the Mississippi
+river
+				
+ An attempt to make the last line less short by wrapping the previous line earlier would result in the following: +
+Circumnavigating
+the
+Mississippi river
+				
+ While the last line would indeed no longer be short, + the penultimate line would be unsightly. + In such cases, user agents are expected + to prefer the first rendering + despite ''text-wrap-style: avoid-orphans'' being set. +
@@ -5626,10 +5706,12 @@ Selecting How to Wrap: the 'text-wrap-style' property UAs can experiment with better line breaking algorithms with this default value, but as optimal results often take more time, - ''text-wrap-style/pretty'' is offered as an opt-in + ''text-wrap-style/pretty'' and ''avoid-orphans'' are offered as opt-ins to take more time for better results. - The ''text-wrap-style/pretty'' value is intended for body text, - where the last line is expected to be a bit shorter than the average line; + Both values are intended for body text, + where the last line is expected to be a bit shorter than the average line, + but ''avoid-orphans'' aims to avoid excessively short last lines while staying performant, + while ''pretty'' can sacrifice more speed in pursuit of even better layout; the ''text-wrap-style/balance'' value is intended for titles and captions, where equal-length lines of text tend to be preferred; and the ''text-wrap-style/stable'' is intended for sections that are,