summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/text/qfontmetrics.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index 5c5320f..4229d5b 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -528,12 +528,14 @@ int QFontMetrics::rightBearing(QChar ch) const
*/
int QFontMetrics::width(const QString &text, int len) const
{
+ int pos = text.indexOf(QLatin1Char('\x9c'));
+ QString txt = (pos == -1) ? text : text.left(pos);
if (len < 0)
- len = text.length();
+ len = txt.length();
if (len == 0)
return 0;
- QTextEngine layout(text, d);
+ QTextEngine layout(txt, d);
layout.ignoreBidi = true;
return qRound(layout.width(0, len));
}