]> git.lyx.org Git - lyx.git/commitdiff
Fix vertical offset of fonts like MinionPro
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 3 Jan 2019 11:14:27 +0000 (12:14 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 5 Jan 2019 13:40:56 +0000 (14:40 +0100)
For some reason, adding a LTR/RTL Override unicode character before a
MinionPro string increases the ascent of the line.

This creates vertical offset issues when painting if the ascent used
as reference is the one of the font. Use the QTextLine ascent instead
for better results.

This is a followup to 1bed76e2a.

Fixes (reopened) ticket #11284.
Fixes ticket #10532.
Fixes ticket #10767.

(cherry picked from commit d8498d4785282a6f42a69f56ebd46ac32e1d2f51)

src/frontends/qt4/GuiPainter.cpp
status.23x

index b03bb44ad31d33ce5ded5217a9e8e958fb9a5a5c..b0b1ec1f6f10290098947d7c1a622e25d3d734fb 100644 (file)
@@ -455,11 +455,10 @@ void GuiPainter::text(int x, int y, docstring const & s,
        // don't use the pixmap cache
        setQPainterPen(computeColor(f.realColor()));
        if (dir != Auto) {
-               shared_ptr<QTextLayout const> ptl =
-                       fm.getTextLayout(s, dir == RtL, wordspacing);
-               ptl->draw(this, QPointF(x, y - fm.maxAscent()));
-       }
-       else {
+               auto ptl = fm.getTextLayout(s, dir == RtL, wordspacing);
+               QTextLine const & tline = ptl->lineForTextPosition(0);
+               ptl->draw(this, QPointF(x, y - tline.ascent()));
+       } else {
                if (font() != ff)
                        setFont(ff);
                drawText(x, y, str);
index bcd0a1380d9cb0c2a1bf8b835d269a3b07c4b752..baee939f05417873c42b052dc5fe00cb856f239d 100644 (file)
@@ -115,6 +115,8 @@ What's new
 
 - Fix document updating issues with split view (bug 11354).
 
+- Fix cases where text is offset vertically (bug 10532, 10767).
+
 
 * INTERNALS