]> git.lyx.org Git - features.git/commit
Fix computation of string width when using a QTextLayout
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 28 Aug 2017 10:05:35 +0000 (12:05 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 28 Aug 2017 12:36:50 +0000 (14:36 +0200)
commit4d845baf0867f15531f10d25b9611d39ac282428
tree7265ba13664b3184b38a985845708f010c92f04f
parent0315d440e9f86a3881e3bbb3044381172c128b8a
Fix computation of string width when using a QTextLayout

It was not a good idea to rely on QTextLine::naturalTextWidth() to
compute a string width. The correct method is horizontalAdvance().

Also round the value to the nearest pixel, since this is what
QFontMetrics::width() does.

Fixes bug #10700 (and maybe others).

(cherry picked from commit c874641e95b763a6d4691fb12fba893580f3018a)
src/frontends/qt4/GuiFontMetrics.cpp