summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text/qtextengine.cpp')
-rw-r--r--src/gui/text/qtextengine.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 4378c62..4f86cff 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -2681,6 +2681,22 @@ void QTextEngine::resolveAdditionalFormats() const
specialData->resolvedFormatIndices = indices;
}
+QFixed QTextEngine::leadingSpaceWidth(const QScriptLine &line)
+{
+ if (!line.hasTrailingSpaces
+ || (option.flags() & QTextOption::IncludeTrailingSpaces)
+ || !isRightToLeft())
+ return QFixed();
+
+ int pos = line.length;
+ const HB_CharAttributes *attributes = this->attributes();
+ if (!attributes)
+ return QFixed();
+ while (pos > 0 && attributes[line.from + pos - 1].whiteSpace)
+ --pos;
+ return width(line.from + pos, line.length - pos);
+}
+
QStackTextEngine::QStackTextEngine(const QString &string, const QFont &f)
: QTextEngine(string, f),
_layoutData(string, _memory, MemSize)