]> 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:05:45 +0000 (14:05 +0200)
commitc874641e95b763a6d4691fb12fba893580f3018a
tree73b4f3b8e378301eabe7740ff98130dd1b300a9c
parentf4511485da817c2821945604c313a2d18f89164b
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).
src/frontends/qt4/GuiFontMetrics.cpp