summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2012-02-27 09:51:46 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-28 01:12:08 +0100
commit7df4890d8a98d872deaebd46ca8d92473a3c6585 (patch)
treeaa5237deb9ec5c663ae67241b3f9135799821639 /src
parentc2baf45c73beaa01df91d466296fd4efca25ee7a (diff)
Fix divide by zero when glyphWidth is 0
Change-Id: Ic0108b76b8d73cc977f8d64e036a65cb93db4684 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qtextengine.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 30170759a0..c63f0fede8 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -2702,6 +2702,8 @@ int QTextEngine::positionInLigature(const QScriptItem *si, int end,
QFixed glyphWidth = glyphs.effectiveAdvance(glyph_pos);
// the approximate width of each individual element of the ligature
QFixed perItemWidth = glyphWidth / clusterLength;
+ if (perItemWidth <= 0)
+ return si->position + clusterStart;
QFixed left = x > edge ? edge : edge - glyphWidth;
int n = ((x - left) / perItemWidth).floor().toInt();
QFixed dist = x - left - n * perItemWidth;