]> git.lyx.org Git - features.git/commit
Break multi-row strings in one pass
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 6 Sep 2021 12:52:42 +0000 (14:52 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 23 Nov 2021 15:31:30 +0000 (16:31 +0100)
commit20f88a3cf30540d76a88ef4ed42f12290e76e869
tree95b58df1647acbfd39b3a6e66fd36402a42ae3ae
parente1108a0b5ab903cc646e4caffe07a3b87c105932
Break multi-row strings in one pass

Replace FontMetrics::breakAt, which returned the next break point,
with FontMetrics::breakString, which returns a vector of break points.
To this end, an additional parameter gives the available width for
next rows.

Rename various variables and methods accordingly. Factor the code in
breakString_helper to be more manageable.

Adapt Row::Element::splitAt to return a bool on sucess and provide
remaining row elements in a vector. The width noted above has been
added as parameters.

Rename the helper function splitFrom to moveElements and rewrite the
code to be more efficient.

Remove type of row element INVALID, which is not needed anymore.

The code in TextMetrics::breakParagraph is now much simpler.

In Row::finalize, remove the code that computed inconditionnally the
current element size, and make sure that this width will be computed
in all code paths of Row::Element::splitAt.
src/Row.cpp
src/Row.h
src/RowPainter.cpp
src/TextMetrics.cpp
src/frontends/FontMetrics.h
src/frontends/qt/GuiFontMetrics.cpp
src/frontends/qt/GuiFontMetrics.h