From 3ffe4283b640825ebf03e2a5506a9d846cc88b11 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 29 Jun 2011 11:19:17 +0200 Subject: Adapt font engines for Windows/QPA. Export QFontEngineMulti and glyph_metrics_t. Implement alphaMapForGlyph() for the multifont-engines which is called in the QPA code paths (similar to boundingBox()). Acked-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qfontengine.cpp | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) (limited to 'src/gui/text/qfontengine.cpp') diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index dec09821d3..f068f396d8 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1674,11 +1674,42 @@ bool QFontEngineMulti::canRender(const QChar *string, int len) return allExist; } -QImage QFontEngineMulti::alphaMapForGlyph(glyph_t) +/* Implement alphaMapForGlyph() which is called by Lighthouse/Windows code. + * Ideally, that code should be fixed to correctly handle QFontEngineMulti. */ + +QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph) +{ + const int which = highByte(glyph); + Q_ASSERT(which < engines.size()); + return engine(which)->alphaMapForGlyph(stripped(glyph)); +} + +QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition) +{ + const int which = highByte(glyph); + Q_ASSERT(which < engines.size()); + return engine(which)->alphaMapForGlyph(stripped(glyph), subPixelPosition); +} + +QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph, const QTransform &t) { - Q_ASSERT(false); - return QImage(); + const int which = highByte(glyph); + Q_ASSERT(which < engines.size()); + return engine(which)->alphaMapForGlyph(stripped(glyph), t); } +QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) +{ + const int which = highByte(glyph); + Q_ASSERT(which < engines.size()); + return engine(which)->alphaMapForGlyph(stripped(glyph), subPixelPosition, t); +} + +QImage QFontEngineMulti::alphaRGBMapForGlyph(glyph_t glyph, QFixed subPixelPosition, int margin, const QTransform &t) +{ + const int which = highByte(glyph); + Q_ASSERT(which < engines.size()); + return engine(which)->alphaRGBMapForGlyph(stripped(glyph), subPixelPosition, margin, t); +} QT_END_NAMESPACE -- cgit v1.2.3 From 6604e1a32481bf311e134c77c5f0aa654909f8d9 Mon Sep 17 00:00:00 2001 From: John Tapsell Date: Thu, 8 Sep 2011 10:14:33 +0200 Subject: Fix RTL layout for fonts when non-printable character has an advance If a non-printable character has an advance, we would lay out the text as if the character was part of the output, and then ignore the character later when the text was rendered. To fix cases such as this, we take the dontPrint attribute into consideration when adjusting the advances. Task-number: QTBUG-21347 Reviewed-by: Eskil Reviewed-by: Lars (cherry picked from commit 6326227674efa85c1a5320141041110d211efc75) Change-Id: I4d01b60498f3b5f30b69530c8b49dd720d83ad0b Reviewed-on: http://codereview.qt-project.org/4410 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qfontengine.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gui/text/qfontengine.cpp') diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 9d42d8ab69..a89bb18e94 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -280,6 +280,8 @@ void QFontEngine::getGlyphPositions(const QGlyphLayout &glyphs, const QTransform int i = glyphs.numGlyphs; int totalKashidas = 0; while(i--) { + if (glyphs.attributes[i].dontPrint) + continue; xpos += glyphs.advances_x[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6); ypos += glyphs.advances_y[i]; totalKashidas += glyphs.justifications[i].nKashidas; -- cgit v1.2.3