From 17e2ad927e51be1c450ef8d38a9a7f44f288f807 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Mon, 8 Oct 2018 16:03:20 +0200 Subject: [PATCH] Followup to 9fe101e8: remove unused method. --- src/frontends/qt4/GuiFontMetrics.cpp | 1 + src/frontends/qt4/GuiPainter.cpp | 47 ++-------------------------- src/frontends/qt4/GuiPainter.h | 3 -- 3 files changed, 3 insertions(+), 48 deletions(-) diff --git a/src/frontends/qt4/GuiFontMetrics.cpp b/src/frontends/qt4/GuiFontMetrics.cpp index 1c2421d11b..484a41bfa1 100644 --- a/src/frontends/qt4/GuiFontMetrics.cpp +++ b/src/frontends/qt4/GuiFontMetrics.cpp @@ -260,6 +260,7 @@ GuiFontMetrics::getTextLayout(docstring const & s, bool const rtl, QFont copy = font_; copy.setWordSpacing(wordspacing); ptl->setFont(copy); + // FIXME: This might not work in all cases. See breakAt_helper. // Note that both setFlags and the enums are undocumented ptl->setFlags(rtl ? Qt::TextForceRightToLeft : Qt::TextForceLeftToRight); ptl->beginLayout(); diff --git a/src/frontends/qt4/GuiPainter.cpp b/src/frontends/qt4/GuiPainter.cpp index 2f0cc8fa4b..8bd9efbe17 100644 --- a/src/frontends/qt4/GuiPainter.cpp +++ b/src/frontends/qt4/GuiPainter.cpp @@ -284,47 +284,6 @@ void GuiPainter::text(int x, int y, docstring const & s, FontInfo const & f) } -void GuiPainter::do_drawText(int x, int y, QString str, - GuiPainter::Direction const dir, - FontInfo const & f, QFont ff) -{ - setQPainterPen(computeColor(f.realColor())); - if (font() != ff) - setFont(ff); - - /* In LyX, the character direction is forced by the language. - * Therefore, we have to signal that fact to Qt. - */ -#if 1 - /* Use unicode override characters to enforce drawing direction - * Source: http://www.iamcal.com/understanding-bidirectional-text/ - */ - if (dir == RtL) - // Right-to-left override: forces to draw text right-to-left - str = QChar(0x202E) + str; - else if (dir == LtR) - // Left-to-right override: forces to draw text left-to-right - str = QChar(0x202D) + str; - drawText(x, y, str); -#else - /* This looks like a cleaner solution, but it has drawbacks - * - does not work reliably (Mac OS X, ...) - * - it is not really documented - * Keep it here for now, in case it can be helpful - */ - //This is much stronger than setLayoutDirection. - int flag = 0; - if (dir == RtL) - flag = Qt::TextForceRightToLeft; - else if (dir == LtR) - flag = Qt::TextForceLeftToRight; - drawText(x + ((dir == RtL) ? textwidth : 0), y - fm.maxAscent(), 0, 0, - flag | Qt::TextDontClip, - str); -#endif -} - - void GuiPainter::text(int x, int y, docstring const & s, FontInfo const & f, Direction const dir, double const wordspacing, double const tw) @@ -369,11 +328,9 @@ void GuiPainter::text(int x, int y, docstring const & s, setQPainterPen(computeColor(f.realColor())); if (dir != Auto) { - shared_ptr ptl = - fm.getTextLayout(s, dir == RtL, wordspacing); + auto ptl = fm.getTextLayout(s, dir == RtL, wordspacing); ptl->draw(this, QPointF(x, y - fm.maxAscent())); - } - else { + } else { if (font() != ff) setFont(ff); drawText(x, y, str); diff --git a/src/frontends/qt4/GuiPainter.h b/src/frontends/qt4/GuiPainter.h index 54b86e4744..a4f40be51c 100644 --- a/src/frontends/qt4/GuiPainter.h +++ b/src/frontends/qt4/GuiPainter.h @@ -184,9 +184,6 @@ private: // Direction for painting text enum Direction { LtR, RtL, Auto }; - // Helper for text() method - void do_drawText(int x, int y, QString str, Direction dir, FontInfo const & f, QFont ff); - // Real text() method void text(int x, int y, docstring const & s, FontInfo const & f, Direction const dir, -- 2.39.2