summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2012-02-27 08:51:46 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-02-28 10:00:56 (GMT)
commit74e777a76b9ac63107a32422c28ad79cd2217250 (patch)
tree0f5b0a55c26be6ddaf3fdcfe4489f68afca86701 /src/gui/text
parent0f3d46b43f344abd8e158166c0e391ef404f2e2d (diff)
downloadQt-74e777a76b9ac63107a32422c28ad79cd2217250.zip
Qt-74e777a76b9ac63107a32422c28ad79cd2217250.tar.gz
Qt-74e777a76b9ac63107a32422c28ad79cd2217250.tar.bz2
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/gui/text')
-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 effb6e1..3137de6 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -2917,6 +2917,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;