]> git.lyx.org Git - features.git/commitdiff
Followup to 9fe101e8: remove unused method.
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 8 Oct 2018 14:03:20 +0000 (16:03 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 8 Oct 2018 14:04:32 +0000 (16:04 +0200)
src/frontends/qt4/GuiFontMetrics.cpp
src/frontends/qt4/GuiPainter.cpp
src/frontends/qt4/GuiPainter.h

index 1c2421d11b9c3e80f7d4f4f83cd4c552cc0bc2ec..484a41bfa1ea8df4fdc9095a28d05b319dd283a0 100644 (file)
@@ -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();
index 2f0cc8fa4b67a469d9d3dcf8658bc54c11537b94..8bd9efbe178ff5a5facd73e1debe0b42f18ed7c9 100644 (file)
@@ -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<QTextLayout const> 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);
index 54b86e4744135b2165bc8e6049cd9bfe4705f1ad..a4f40be51c7b9e797f6638052a75f1028b80f2ce 100644 (file)
@@ -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,