From: Jean-Marc Lasgouttes Date: Thu, 3 Jan 2019 11:14:27 +0000 (+0100) Subject: Fix vertical offset of fonts like MinionPro X-Git-Tag: lyx-2.4.0dev-acb2ca7b~2752 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=d8498d4785282a6f42a69f56ebd46ac32e1d2f51;p=features.git 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. --- diff --git a/src/frontends/qt4/GuiPainter.cpp b/src/frontends/qt4/GuiPainter.cpp index 8bd9efbe17..e0b2177c92 100644 --- a/src/frontends/qt4/GuiPainter.cpp +++ b/src/frontends/qt4/GuiPainter.cpp @@ -329,7 +329,8 @@ void GuiPainter::text(int x, int y, docstring const & s, setQPainterPen(computeColor(f.realColor())); if (dir != Auto) { auto ptl = fm.getTextLayout(s, dir == RtL, wordspacing); - ptl->draw(this, QPointF(x, y - fm.maxAscent())); + QTextLine const & tline = ptl->lineForTextPosition(0); + ptl->draw(this, QPointF(x, y - tline.ascent())); } else { if (font() != ff) setFont(ff);