]> git.lyx.org Git - lyx.git/commit
Do not break row elements at spaces
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 18 Jul 2015 23:22:10 +0000 (01:22 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 20 Jul 2015 19:22:53 +0000 (21:22 +0200)
commitf65f3adbf73283a288f5d186b51b6b98c9ecb51d
tree4ecadcb97a09e2aadce24843da1fc7d06ddf5dcb
parent038f003be671995e7c60b2be884c7799303ca840
Do not break row elements at spaces

The goal of this commit is to make painting faster by reducing the
number of strings to paint. To this end, it is necessary to include
spaces in row elements.

Also importantly, this commit should fix existing problems with line
breaking in chinese text.

* TextMetrics::breakRow: do not do anything special for word separators.

* Row::add: when adding a character to a row element, keep the string
  width updated. If need be, it is possible to tweak this by updating
  every 10 characters, for example.

* GuiFontMetrics::breakAt (new): use QTextLayout to break text either
  at word boundary or at an arbitrary width.

* Row::Element::breakAt: use the above method.

* Row::shortenIfNeeded: simplify now that because there is no need for
  handling separator elements. This will be taken care of by the
  improved breakAt.

Two things remain to be done:

* remove all traces of separator row element

* re-implement text justification.
src/Row.cpp
src/Row.h
src/TextMetrics.cpp
src/frontends/FontMetrics.h
src/frontends/qt4/GuiFontMetrics.cpp
src/frontends/qt4/GuiFontMetrics.h