From e73c0d6387f0be4b1d5e3a47e0b6d29585c52cbc Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Thu, 3 Jan 2019 12:14:27 +0100 Subject: [PATCH] Fix vertical offset of fonts like MinionPro 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 | 9 ++++----- status.23x | 2 ++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/frontends/qt4/GuiPainter.cpp b/src/frontends/qt4/GuiPainter.cpp index b03bb44ad3..b0b1ec1f6f 100644 --- a/src/frontends/qt4/GuiPainter.cpp +++ b/src/frontends/qt4/GuiPainter.cpp @@ -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 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); diff --git a/status.23x b/status.23x index bcd0a1380d..baee939f05 100644 --- a/status.23x +++ b/status.23x @@ -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