summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Tapsell <john.tapsell.ext@basyskom.de>2011-09-08 10:14:33 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2011-09-08 10:30:50 +0200
commit6604e1a32481bf311e134c77c5f0aa654909f8d9 (patch)
treee02bb6b30a67dff57aaca5f97015e21337f6b996
parentb05d022ccda5707eb0c4b545bb273fa4af67a3a8 (diff)
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 <eskil.abrahamsen-blomfeldt@nokia.com>
-rw-r--r--src/gui/text/qfontengine.cpp2
-rw-r--r--src/gui/text/qtextengine.cpp4
2 files changed, 4 insertions, 2 deletions
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;
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 95a797439a..91c96fce80 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -968,7 +968,7 @@ void QTextEngine::shapeText(int item) const
}
for (int i = 0; i < si.num_glyphs; ++i)
- si.width += glyphs.advances_x[i];
+ si.width += glyphs.advances_x[i] * !glyphs.attributes[i].dontPrint;
}
static inline bool hasCaseChange(const QScriptItem &si)
@@ -2664,7 +2664,7 @@ void QTextEngine::splitItem(int item, int pos) const
QFixed w = 0;
const QGlyphLayout g = shapedGlyphs(&oldItem);
for(int j = 0; j < breakGlyph; ++j)
- w += g.advances_x[j];
+ w += g.advances_x[j] * !g.attributes[j].dontPrint;
newItem.width = oldItem.width - w;
oldItem.width = w;