Implementing the Knuth and Plass line breaking algorithm
Categories
(Core :: Layout: Text and Fonts, enhancement)
Tracking
()
People
(Reporter: Jeremie, Unassigned)
References
(Blocks 1 open bug)
Details
Comment 1•14 years ago
|
||
Reporter | ||
Comment 2•14 years ago
|
||
Comment 3•14 years ago
|
||
Comment 4•14 years ago
|
||
Reporter | ||
Comment 5•14 years ago
|
||
Comment 6•13 years ago
|
||
Comment 7•13 years ago
|
||
Comment 9•13 years ago
|
||
Comment 10•13 years ago
|
||
Reporter | ||
Updated•12 years ago
|
Comment 11•11 years ago
|
||
Comment 12•11 years ago
|
||
Comment 13•11 years ago
|
||
Updated•11 years ago
|
Comment 14•4 years ago
|
||
It's possible that, if implemented, this could be activated by text-wrap: balance
.
Comment 15•4 years ago
|
||
... actually, no, I was misreading the spec. balance
is an entirely different feature that includes balancing the last line.
Comment 16•4 years ago
|
||
There’s a lot of conceptual overlap with balance
, but it is indeed definitely a different type of wrapping. But the text-wrap
property is relevant here.
It’d be text-wrap: pretty
that you’d use to definitely opt into Knuth-Plass.
And text-wrap: stable
would definitely opt out of it, retaining the current greedy wrapping algorithm.
The key would be what text-wrap: wrap
(the default value) means. I suspect some experimentation would be warranted. The safe thing to do would be for it to be equivalent to stable
; anything beyond that and you’re just about certain to make some things behave strangely, however rare. I suspect a decent initial heuristic would be: stable
if within a textarea or contenteditable, otherwise pretty
.
Comment 17•4 years ago
|
||
I plan to attempt to partially implement this over the next few weeks. I'll try to document what I learn in the process, even if I can't get anything to work
Updated•2 years ago
|
Comment 18•1 year ago
|
||
Chromium is working on text-wrap: pretty
: https://bugs.chromium.org/p/chromium/issues/detail?id=1432798
Description
•