Commit 64a06257 authored by Michael Reeves's avatar Michael Reeves

Missed one.

parent 371e105d
......@@ -32,13 +32,13 @@ class Utils{
inline static bool isEndOfLine( QChar c ) { return c=='\n' || c=='\r' || c=='\x0b'; }
//Where posiable use QTextLayout in place of these functions especially when dealing with non-latin scripts.
inline static int getHorizontalAdvance(const QFontMetrics &metrics, const QString& s)
inline static int getHorizontalAdvance(const QFontMetrics &metrics, const QString& s, int len = -1)
{
//Warning: The Qt API used here is not accurate for some non-latin characters.
#if QT_VERSION < QT_VERSION_CHECK(5,12,0)
return metrics.width(s);
return metrics.width(s, len);
#else
return metrics.horizontalAdvance(s);
return metrics.horizontalAdvance(s, len);
#endif
}
......@@ -46,7 +46,7 @@ class Utils{
{
//Warning: The Qt API used here is not accurate for some non-latin characters.
#if QT_VERSION < QT_VERSION_CHECK(5,12,0)
return metrics.width(s);
return metrics.width(c);
#else
return metrics.horizontalAdvance(c);
#endif
......
......@@ -800,7 +800,7 @@ void printDiffTextWindow(RLPainter& painter, const QRect& view, const QString& h
QString s = headerText.mid(p);
int i;
for(i = 2; i < s.length(); ++i)
if(fm.width(s, i) > view.width())
if(Utils::getHorizontalAdvance(fm, s, i) > view.width())
{
--i;
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment