summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpainter.cpp
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@nokia.com>2010-05-25 18:19:14 (GMT)
committerJocelyn Turcotte <jocelyn.turcotte@nokia.com>2010-05-31 16:23:05 (GMT)
commit032fb3d54eaaa1fa36ec45b37f5f7356b1137830 (patch)
tree127dc0c3555003432aaa8add2b73385b24c74c4d /src/gui/painting/qpainter.cpp
parent33fddc2adf95b56d8309ef9bc11408252140a085 (diff)
downloadQt-032fb3d54eaaa1fa36ec45b37f5f7356b1137830.zip
Qt-032fb3d54eaaa1fa36ec45b37f5f7356b1137830.tar.gz
Qt-032fb3d54eaaa1fa36ec45b37f5f7356b1137830.tar.bz2
Add the Qt::TextBypassShaping flag.
This allows quick layouting especially with Windows fonts which contain heavy OpenType logic. On regular latin text the visual compromize is the loss of kerning, justification, capitalization, word spacing and letter spacing support. Reviewed-by: Simon Hausmann Reviewed-by: Eskil
Diffstat (limited to 'src/gui/painting/qpainter.cpp')
-rw-r--r--src/gui/painting/qpainter.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 657229a..54e0aa3 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -5937,6 +5937,23 @@ void QPainter::drawText(const QPointF &p, const QString &str, int tf, int justif
if (!d->engine || str.isEmpty() || pen().style() == Qt::NoPen)
return;
+ if (tf & Qt::TextBypassShaping) {
+ // Skip harfbuzz complex shaping, shape using glyph advances only
+ int len = str.length();
+ int numGlyphs = len;
+ QVarLengthGlyphLayoutArray glyphs(len);
+ QFontEngine *fontEngine = d->state->font.d->engineForScript(QUnicodeTables::Common);
+ if (!fontEngine->stringToCMap(str.data(), len, &glyphs, &numGlyphs, 0)) {
+ glyphs.resize(numGlyphs);
+ if (!fontEngine->stringToCMap(str.data(), len, &glyphs, &numGlyphs, 0))
+ Q_ASSERT_X(false, Q_FUNC_INFO, "stringToCMap shouldn't fail twice");
+ }
+
+ QTextItemInt gf(glyphs, &d->state->font, fontEngine);
+ drawTextItem(p, gf);
+ return;
+ }
+
QStackTextEngine engine(str, d->state->font);
engine.option.setTextDirection(d->state->layoutDirection);
if (tf & (Qt::TextForceLeftToRight|Qt::TextForceRightToLeft)) {