summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-21 14:27:44 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-21 14:27:44 (GMT)
commit66f02b76e7cd70545037d4eae984ed6819e39f1f (patch)
treeaf2ff3f7580b6b0c650620869b4ecc86d0398f87 /src
parentc24bff633684b99d05e28bd4926e557fb553cf75 (diff)
parentbff73e4c96fa4bf07534bd142302af08fa193bfa (diff)
downloadQt-66f02b76e7cd70545037d4eae984ed6819e39f1f.zip
Qt-66f02b76e7cd70545037d4eae984ed6819e39f1f.tar.gz
Qt-66f02b76e7cd70545037d4eae984ed6819e39f1f.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public: correctly position glyphs for complex languages Removed inneccessary QGlyphLayout::offsets initialization. Fix mirrored characters for RTL text in Symbian
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qfontengine_s60.cpp8
-rw-r--r--src/openvg/qpaintengine_vg.cpp54
2 files changed, 27 insertions, 35 deletions
diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp
index c9ff661..e557f56 100644
--- a/src/gui/text/qfontengine_s60.cpp
+++ b/src/gui/text/qfontengine_s60.cpp
@@ -221,9 +221,11 @@ bool QFontEngineS60::stringToCMap(const QChar *characters, int len, QGlyphLayout
HB_Glyph *g = glyphs->glyphs;
const unsigned char* cmap = m_extensions->cmap();
+ const bool isRtl = (flags & QTextEngine::RightToLeft);
for (int i = 0; i < len; ++i) {
const unsigned int uc = getChar(characters, i, len);
- *g++ = QFontEngine::getTrueTypeGlyphIndex(cmap, uc);
+ *g++ = QFontEngine::getTrueTypeGlyphIndex(cmap,
+ isRtl ? QChar::mirroredChar(uc) : uc);
}
glyphs->numGlyphs = g - glyphs->glyphs;
@@ -241,8 +243,8 @@ void QFontEngineS60::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla
Q_UNUSED(flags);
for (int i = 0; i < glyphs->numGlyphs; i++) {
const glyph_metrics_t bbox = boundingBox_const(glyphs->glyphs[i]);
- glyphs->advances_x[i] = glyphs->offsets[i].x = bbox.xoff;
- glyphs->advances_y[i] = glyphs->offsets[i].y = bbox.yoff;
+ glyphs->advances_x[i] = bbox.xoff;
+ glyphs->advances_y[i] = bbox.yoff;
}
}
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index 7445fd7..cabb41c 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -183,7 +183,6 @@ public:
qreal penScale; // Pen scaling factor from "transform".
QTransform pathTransform; // Calculated VG path transformation.
- QTransform glyphTransform; // Calculated VG glyph transformation.
QTransform imageTransform; // Calculated VG image transformation.
bool pathTransformSet; // True if path transform set in the VG context.
@@ -508,24 +507,15 @@ void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev)
// | 1 0 0 |
// | 0 -1 devh |
// | 0 0 1 |
- // The glyph transform uses a slightly different transformation:
- // | 1 0 0 | | 1 0 0.5 | | 1 0 0.5 |
- // | 0 -1 devh - 1 | * | 0 1 -0.5 | = | 0 -1 (devh - 0.5) |
- // | 0 0 1 | | 0 0 1 | | 0 0 1 |
// The full VG transform is effectively:
// 1. Apply the user's transformation matrix.
- // 2. Translate glyphs by an extra (0.5, -0.5).
- // 3. Flip the co-ordinate system upside down.
+ // 2. Flip the co-ordinate system upside down.
QTransform viewport(1.0f, 0.0f, 0.0f,
0.0f, -1.0f, 0.0f,
0.0f, devh, 1.0f);
- QTransform gviewport(1.0f, 0.0f, 0.0f,
- 0.0f, -1.0f, 0.0f,
- 0.5f, devh - 0.5f, 1.0f);
// Compute the path transform and determine if it is projective.
pathTransform = transform * viewport;
- glyphTransform = transform * gviewport;
bool projective = (pathTransform.m13() != 0.0f ||
pathTransform.m23() != 0.0f ||
pathTransform.m33() != 1.0f);
@@ -534,7 +524,6 @@ void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev)
// so we will have to convert the co-ordinates ourselves.
// Change the matrix to just the viewport transformation.
pathTransform = viewport;
- glyphTransform = gviewport;
simpleTransform = false;
} else {
simpleTransform = true;
@@ -3248,10 +3237,10 @@ void QVGFontGlyphCache::cacheGlyphs
vgImageSubData(vgImage, qt_vg_imageBits(img), img.bytesPerLine(), VG_sARGB_8888_PRE, 0, 0, img.width(), img.height());
}
}
- origin[0] = -metrics.x.toReal() + 0.5f;
- origin[1] = -metrics.y.toReal() + 0.5f;
- escapement[0] = metrics.xoff.toReal();
- escapement[1] = metrics.yoff.toReal();
+ origin[0] = -metrics.x.toReal();
+ origin[1] = -metrics.y.toReal();
+ escapement[0] = 0;
+ escapement[1] = 0;
vgSetGlyphToImage(font, glyph, vgImage, origin, escapement);
vgDestroyImage(vgImage); // Reduce reference count.
#else
@@ -3267,8 +3256,8 @@ void QVGFontGlyphCache::cacheGlyphs
}
origin[0] = 0;
origin[1] = 0;
- escapement[0] = metrics.xoff.toReal();
- escapement[1] = metrics.yoff.toReal();
+ escapement[0] = 0;
+ escapement[1] = 0;
vgSetGlyphToPath(font, glyph, vgPath, VG_FALSE, origin, escapement);
vgDestroyPath(vgPath); // Reduce reference count.
#endif // !defined(QVG_NO_IMAGE_GLYPHS)
@@ -3293,10 +3282,8 @@ void QVGPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
// Get the glyphs and positions associated with the text item.
QVarLengthArray<QFixedPoint> positions;
QVarLengthArray<glyph_t> glyphs;
- QTransform matrix = d->transform;
- matrix.translate(p.x(), p.y());
- ti.fontEngine->getGlyphPositions
- (ti.glyphs, matrix, ti.flags, glyphs, positions);
+ QTransform matrix;
+ ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
// Find the glyph cache for this font.
QVGFontCache::ConstIterator it = d->fontCache.constFind(ti.fontEngine);
@@ -3320,7 +3307,7 @@ void QVGPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
}
// Set the transformation to use for drawing the current glyphs.
- QTransform glyphTransform(d->glyphTransform);
+ QTransform glyphTransform(d->pathTransform);
glyphTransform.translate(p.x(), p.y());
#if defined(QVG_NO_IMAGE_GLYPHS)
glyphTransform.scale(glyphCache->scaleX, glyphCache->scaleY);
@@ -3330,10 +3317,18 @@ void QVGPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
// Add the glyphs from the text item into the glyph cache.
glyphCache->cacheGlyphs(d, ti, glyphs);
+ // Create the array of adjustments between glyphs
+ QVarLengthArray<VGfloat> adjustments_x(glyphs.size());
+ QVarLengthArray<VGfloat> adjustments_y(glyphs.size());
+ for (int i = 1; i < glyphs.size(); ++i) {
+ adjustments_x[i-1] = (positions[i].x - positions[i-1].x).toReal();
+ adjustments_y[i-1] = (positions[i].y - positions[i-1].y).toReal();
+ }
+
// Set the glyph drawing origin.
VGfloat origin[2];
- origin[0] = 0;
- origin[1] = 0;
+ origin[0] = positions[0].x.toReal();
+ origin[1] = positions[0].y.toReal();
vgSetfv(VG_GLYPH_ORIGIN, 2, origin);
// Fast anti-aliasing for paths, better for images.
@@ -3347,13 +3342,8 @@ void QVGPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
// Draw the glyphs. We need to fill with the brush associated with
// the Qt pen, not the Qt brush.
d->ensureBrush(state()->pen.brush());
- if (ti.renderFlags() & QTextItem::RightToLeft) {
- for (int index = glyphs.size() - 1; index >= 0; --index)
- vgDrawGlyph(glyphCache->font, glyphs[index], VG_FILL_PATH, VG_TRUE);
- } else {
- vgDrawGlyphs(glyphCache->font, glyphs.size(), (VGuint*)glyphs.data(),
- NULL, NULL, VG_FILL_PATH, VG_TRUE);
- }
+ vgDrawGlyphs(glyphCache->font, glyphs.size(), (VGuint*)glyphs.data(),
+ adjustments_x.data(), adjustments_y.data(), VG_FILL_PATH, VG_TRUE);
#else
// OpenGL 1.0 does not have support for VGFont and glyphs,
// so fall back to the default Qt path stroking algorithm.