Contact [email protected]

ExplainerNone

Specificationhttps://drafts.csswg.org/css-text-4/#valdef-text-wrap-pretty

Design docs
https://docs.google.com/document/d/1jJFD8nAUuiUX6ArFZQqQo8yTsvg8IuAq7oFrNQxPeqI/edit?usp=sharing

Summary

Adjusts line breaking to avoid a short single word on the last line (also
known as typographic orphans.) When `text-wrap: pretty` is specified,
paragraphs that will end up with a short single word on the last line are
adjusted so that the last line has two or more words. The algorithm is
based on the Knuth-Plass algorithm, as used by TeX. It computes scores for
all candidates, and chooses the best one. To balance between the
typographic benefits and the performance impacts, it adjsuts the last 4
lines of paragraphs that meet certain conditions.


Blink componentBlink>Layout>Inline
<https://bugs.chromium.org/p/chromium/issues/list?q=component:Blink%3ELayout%3EInline>

TAG reviewNone

TAG review statusNot applicable

Risks


Interoperability and Compatibility

Low. This value only sets a bias for better layout over speed, without any
particular requirements. Browsers that don't support this value will fall
back to their default line breaking algorithm, but both the exact line
breaking results for this value and for the default value are not defined.


*Gecko*: Positive (https://bugzilla.mozilla.org/show_bug.cgi?id=630181)

*WebKit*: Positive (https://github.com/w3c/csswg-drafts/issues/672) This
property is originally requested by an WebKit engineer.

*Web developers*: Positive (
https://clagnut.com/blog/2424#:~:text=the%20specification%20is-,text%2Dwrap%3Apretty,-.%20If%20it%E2%80%99s%20ever)
When Blink shipped `text-wrap: balance` that improved headlines, many
tweets and articles are seen on the web, wanting the feature to avoid a
single word on the last line (typographic orphans) for body text.
https://medium.com/swlh/typographic-orphans-on-the-web-266e32f756fe has a
simple JS solution to avoid typographic orphans.
https://github.com/robertknight/tex-linebreak is a JS implementation of the
Knuth-Plass algorithm, has 111 stars.

*Other signals*:

Ergonomics

Another related value of this property `text-wrap: balance` improves line
breaking for headlines, while this value improves typography for body text.


WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that
it has potentially high risk for Android WebView-based applications?

None.


Debuggability



Will this feature be supported on all six Blink platforms (Windows, Mac,
Linux, Chrome OS, Android, and Android WebView)?Yes

Is this feature fully tested by web-platform-tests
<https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md>
?Yes

Flag name

Requires code in //chrome?False

Tracking bughttps://bugs.chromium.org/p/chromium/issues/detail?id=1432798

Sample links
https://output.jsbin.com/hopejeb

Estimated milestones
Shipping on desktop 117
Shipping on Android 117
Shipping on WebView 117

Anticipated spec changes

Open questions about a feature may be a source of future web compat or
interop issues. Please list open issues (e.g. links to known github issues
in the project for the feature specification) whose resolution may
introduce web compat/interop risk (e.g., changing to naming or structure of
the API in a non-backward-compatible way).
None.

Link to entry on the Chrome Platform Status
https://chromestatus.com/feature/5145771917180928

Links to previous Intent discussions

This intent message was generated by Chrome Platform Status
<https://chromestatus.com/>.

-- 
You received this message because you are subscribed to the Google Groups 
"blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAHe_1dJHcCJ8TzS6nG27Uem_6keVwTgArBPtFzg29KHiUOPumQ%40mail.gmail.com.

Reply via email to