| 1 |
diff -ruN cairo-1.10.2-0-vanilla/src/cairo-qt-surface.cpp cairo-1.10.2/src/cairo-qt-surface.cpp
|
| 2 |
--- cairo-1.10.2-0-vanilla/src/cairo-qt-surface.cpp 2010-12-25 15:21:34.000000000 +0100
|
| 3 |
+++ cairo-1.10.2/src/cairo-qt-surface.cpp 2011-12-20 22:59:30.000000000 +0100
|
| 4 |
@@ -61,7 +61,9 @@
|
| 5 |
#include <QtGui/QX11Info>
|
| 6 |
#include <QtCore/QVarLengthArray>
|
| 7 |
|
| 8 |
-#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)) || defined(QT_GLYPHS_API_BACKPORT)
|
| 9 |
+#if (QT_VERSION >= QT_VERSION_CHECK(4, 8, 0))
|
| 10 |
+#include <QtGui/QGlyphRun>
|
| 11 |
+#elif (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)) || defined(QT_GLYPHS_API_BACKPORT)
|
| 12 |
extern void qt_draw_glyphs(QPainter *, const quint32 *glyphs, const QPointF *positions, int count);
|
| 13 |
#endif
|
| 14 |
|
| 15 |
@@ -1370,7 +1372,39 @@
|
| 16 |
cairo_clip_t *clip,
|
| 17 |
int *remaining_glyphs)
|
| 18 |
{
|
| 19 |
-#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)) || defined(QT_GLYPHS_API_BACKPORT)
|
| 20 |
+#if (QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)) && !defined(QT_NO_RAWFONT)
|
| 21 |
+ cairo_qt_surface_t *qs = (cairo_qt_surface_t *) abstract_surface;
|
| 22 |
+
|
| 23 |
+ // pick out the colour to use from the cairo source
|
| 24 |
+ cairo_solid_pattern_t *solid = (cairo_solid_pattern_t*) source;
|
| 25 |
+ // documentation says you have to freeze the cache, but I don't believe it
|
| 26 |
+ _cairo_scaled_font_freeze_cache(scaled_font);
|
| 27 |
+
|
| 28 |
+ QColor tempColour(solid->color.red * 255, solid->color.green * 255, solid->color.blue * 255);
|
| 29 |
+ QVector<QPointF> positions(num_glyphs);
|
| 30 |
+ QVector<unsigned int> glyphss(num_glyphs);
|
| 31 |
+ FT_Face face = cairo_ft_scaled_font_lock_face (scaled_font);
|
| 32 |
+ const FT_Size_Metrics& ftMetrics = face->size->metrics;
|
| 33 |
+ QFont font(face->family_name);
|
| 34 |
+ font.setStyleStrategy(QFont::NoFontMerging);
|
| 35 |
+ font.setBold(face->style_flags & FT_STYLE_FLAG_BOLD);
|
| 36 |
+ font.setItalic(face->style_flags & FT_STYLE_FLAG_ITALIC);
|
| 37 |
+ font.setKerning(face->face_flags & FT_FACE_FLAG_KERNING);
|
| 38 |
+ font.setPixelSize(ftMetrics.y_ppem);
|
| 39 |
+ cairo_ft_scaled_font_unlock_face(scaled_font);
|
| 40 |
+ qs->p->setFont(font);
|
| 41 |
+ qs->p->setPen(tempColour);
|
| 42 |
+ for (int currentGlyph = 0; currentGlyph < num_glyphs; currentGlyph++) {
|
| 43 |
+ positions.append(QPointF(glyphs[currentGlyph].x, glyphs[currentGlyph].y));
|
| 44 |
+ glyphss.append(glyphs[currentGlyph].index);
|
| 45 |
+ }
|
| 46 |
+ QGlyphRun qglyphs;
|
| 47 |
+ qglyphs.setGlyphIndexes(glyphss);
|
| 48 |
+ qglyphs.setPositions(positions);
|
| 49 |
+ qs->p->drawGlyphRun(QPointF(), qglyphs);
|
| 50 |
+ _cairo_scaled_font_thaw_cache(scaled_font);
|
| 51 |
+ return CAIRO_INT_STATUS_SUCCESS;
|
| 52 |
+#elif (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)) || defined(QT_GLYPHS_API_BACKPORT)
|
| 53 |
cairo_qt_surface_t *qs = (cairo_qt_surface_t *) abstract_surface;
|
| 54 |
|
| 55 |
// pick out the colour to use from the cairo source
|