]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/QLPainter.C
enable Font cache only for MacOSX and inline width() for other platform.
[lyx.git] / src / frontends / qt4 / QLPainter.C
index 3a388e389a783279a7bb108143f3df6dcc7297fb..f306ebc330944b6873d35b2859837300030d184e 100644 (file)
 
 #include "QLPainter.h"
 
+#include "GuiApplication.h"
 #include "GuiWorkArea.h"
 #include "QLImage.h"
-#include "ColorCache.h"
 #include "FontLoader.h"
 
-#include "Application.h"
+#include "GuiApplication.h"
+#include "qt_helpers.h"
 
 #include "debug.h"
 #include "language.h"
@@ -92,7 +93,7 @@ void QLPainter::setQPainterPen(LColor_color col,
 
        QPen pen = qp_.get()->pen();
 
-       pen.setColor(lcolorcache.get(col));
+       pen.setColor(guiApp->colorCache().get(col));
 
        switch (ls) {
                case line_solid: pen.setStyle(Qt::SolidLine); break;
@@ -157,7 +158,7 @@ void QLPainter::rectangle(int x, int y, int w, int h,
 
 void QLPainter::fillRectangle(int x, int y, int w, int h, LColor_color col)
 {
-       qp_->fillRect(x, y, w, h, lcolorcache.get(col));
+       qp_->fillRect(x, y, w, h, guiApp->colorCache().get(col));
 }
 
 
@@ -201,8 +202,8 @@ void QLPainter::smallCapsText(int x, int y,
        LyXFont smallfont(f);
        smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE);
 
-       QFont const & qfont = theApp->fontLoader().get(f);
-       QFont const & qsmallfont = theApp->fontLoader().get(smallfont);
+       QFont const & qfont = guiApp->guiFontLoader().get(f);
+       QFont const & qsmallfont = guiApp->guiFontLoader().get(smallfont);
        QFontMetrics const & qfontm = QFontMetrics(qfont);
        QFontMetrics const & qsmallfontm = QFontMetrics(qsmallfont);
 
@@ -239,11 +240,7 @@ void QLPainter::text(int x, int y, char_type const * s, size_t ls,
        for (unsigned int i = 0; i < ls; ++i)
                str[i] = QChar(encoding->ucs(s[i]));
 #else
-       //std::vector<boost::uint32_t> in(s, s + ls);
-       //std::vector<unsigned short> ucs2 = ucs4_to_ucs2(in);
-       std::vector<unsigned short> ucs2 = ucs4_to_ucs2(s, ls);
-       ucs2.push_back(0);
-       QString str = QString::fromUtf16(&ucs2[0]);
+       QString str = ucs4_to_qstring(s, ls);
 #endif
 
 #if 0
@@ -255,7 +252,7 @@ void QLPainter::text(int x, int y, char_type const * s, size_t ls,
 
        if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) {
                setQPainterPen(f.realColor());
-               qp_->setFont(theApp->fontLoader().get(f));
+               qp_->setFont(guiApp->guiFontLoader().get(f));
                // We need to draw the text as LTR as we use our own bidi code.
                qp_->setLayoutDirection(Qt::LeftToRight);
                qp_->drawText(x, y, str);