summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-04-26 17:48:55 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-04-26 17:48:55 (GMT)
commit7783b04aad1d90e84e6e66a6c99f6eeca97b1342 (patch)
tree72d0728d19a9c96254fa5cf8a9581d9990c4c516 /src/gui/text
parentb47fcc45fc3d4fc9b23aedeb2d5ef46d7e28628e (diff)
parente945c5009881eac49fd9b54966643a7e9d24c433 (diff)
downloadQt-7783b04aad1d90e84e6e66a6c99f6eeca97b1342.zip
Qt-7783b04aad1d90e84e6e66a6c99f6eeca97b1342.tar.gz
Qt-7783b04aad1d90e84e6e66a6c99f6eeca97b1342.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Add new exported symbol to QtGuiu.def Handle uppercase 'E' when parsing numbers in SVGs. Let QTextLine decide its own x position in QPainter Support text decoration in QML when using static text back-end Fix missing color in text when using static text back-end in QML
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qtextengine.cpp16
-rw-r--r--src/gui/text/qtextengine_p.h1
-rw-r--r--src/gui/text/qtextlayout.cpp19
3 files changed, 18 insertions, 18 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)
diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h
index 34723ab..67d7453 100644
--- a/src/gui/text/qtextengine_p.h
+++ b/src/gui/text/qtextengine_p.h
@@ -592,6 +592,7 @@ public:
QString elidedText(Qt::TextElideMode mode, const QFixed &width, int flags = 0) const;
void shapeLine(const QScriptLine &line);
+ QFixed leadingSpaceWidth(const QScriptLine &line);
private:
void setBoundary(int strPos) const;
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 905f81b..692620f 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -64,23 +64,6 @@ QT_BEGIN_NAMESPACE
#define SuppressText 0x5012
#define SuppressBackground 0x513
-static inline QFixed leadingSpaceWidth(QTextEngine *eng, const QScriptLine &line)
-{
- if (!line.hasTrailingSpaces
- || (eng->option.flags() & QTextOption::IncludeTrailingSpaces)
- || !(eng->option.alignment() & Qt::AlignRight)
- || !eng->isRightToLeft())
- return QFixed();
-
- int pos = line.length;
- const HB_CharAttributes *attributes = eng->attributes();
- if (!attributes)
- return QFixed();
- while (pos > 0 && attributes[line.from + pos - 1].whiteSpace)
- --pos;
- return eng->width(line.from + pos, line.length - pos);
-}
-
static QFixed alignLine(QTextEngine *eng, const QScriptLine &line)
{
QFixed x = 0;
@@ -91,7 +74,7 @@ static QFixed alignLine(QTextEngine *eng, const QScriptLine &line)
if (align & Qt::AlignJustify && eng->isRightToLeft())
align = Qt::AlignRight;
if (align & Qt::AlignRight)
- x = line.width - (line.textAdvance + leadingSpaceWidth(eng, line));
+ x = line.width - (line.textAdvance + eng->leadingSpaceWidth(line));
else if (align & Qt::AlignHCenter)
x = (line.width - line.textAdvance)/2;
}