Re: [csswg-drafts] [css-text-4] Allow for paragraph-level line breaking

On Wed, 2018-04-11 at 09:02 -0700, CSS Meeting Bot wrote:
> The Working Group just discussed `Allow for paragraph-level line
> breaking`.

Just a couple of points to add that may help:
(1) Knuth-Plass is not suitable for content-editable text without a LOT
of work on UX, because editing a word even slightly might make the text
format into a different number of lines and move the insertion point
somewhat distressingly. It's been done e.g. years ago in InterViews,
but it's really best just to use the normal first-fit algorithm for
editable content.

I'd suggested at one point a property to say that an element's content
might be edited in the future even if it doesn't contain content-
editable, so that setting content-editable wouldn't need to trigger a
reflow. that suggestion was adopted by the CSS WG bt never made it into
text 4, and i didn't push because of the Houdini work just getting
started.

(2) if you use first fit with a 2-line buffer, and move a single word
down from a tight line onto the next line if the next line is looser is
really super fast, makes a huge improvement, and plays much more nicely
with content-editable.

(2b) you can extend the 2-line buffer to n-lines and do a better job of
averaging out the line lengths (or the space sizes for justified text),
but it's not neccessary to use large values of n (7 is probably enough)
especially if it's a floating window (lines 1...n, then 2...n+1, and so
on, or move down by max(n/2 - 1, 1) lines each time) and it's still
linear on the number of lines, where Knuth-Plass is NP-complete on the
number of words in the block and can quickly get expensive.



-- 
Liam Quin, W3C, http://www.w3.org/People/Quin/
Staff contact for Verifiable Claims WG, SVG WG, XQuery WG
Improving Web Advertising: https://www.w3.org/community/web-adv/
Personal: awesome vintage art: http://www.fromoldbooks.org/


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

Received on Thursday, 12 April 2018 18:32:04 UTC