summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-02-10 16:57:11 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2015-02-10 16:57:11 +0000
commit0866680bd904aff4fe2a643a2b81c460cbb99c77 (patch)
tree242dae052199994a35f5e68578661175241a0a71 /src/gui/text
parent34ea269b3b173498312b0203d6875ef3b4ba0253 (diff)
parentfc35f714340d5361231506dfbead132122f59460 (diff)
Merge "Merge remote-tracking branch 'origin/5.4' into dev" into refs/staging/dev
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qfontdatabase.cpp2
-rw-r--r--src/gui/text/qfontengine.cpp13
-rw-r--r--src/gui/text/qtextcursor.cpp10
-rw-r--r--src/gui/text/qtextdocument.cpp5
-rw-r--r--src/gui/text/qtextengine.cpp17
-rw-r--r--src/gui/text/qtextformat.cpp4
6 files changed, 33 insertions, 18 deletions
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 8dbd78cd57..01c33fc6bd 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -412,7 +412,7 @@ void QtFontFamily::ensurePopulated()
return;
QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFamily(name);
- Q_ASSERT(populated);
+ Q_ASSERT_X(populated, Q_FUNC_INFO, qPrintable(name));
}
class QFontDatabasePrivate
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 98ab78f0dc..a9d34b1815 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -77,7 +77,12 @@ static inline bool qtransform_equals_no_translate(const QTransform &a, const QTr
// Harfbuzz helper functions
#ifdef QT_ENABLE_HARFBUZZ_NG
-bool useHarfbuzzNG = qgetenv("QT_HARFBUZZ") != "old";
+Q_GLOBAL_STATIC_WITH_ARGS(bool, useHarfbuzzNG,(qgetenv("QT_HARFBUZZ") != "old"))
+
+bool qt_useHarfbuzzNG()
+{
+ return *useHarfbuzzNG();
+}
#endif
Q_STATIC_ASSERT(sizeof(HB_Glyph) == sizeof(glyph_t));
@@ -282,7 +287,7 @@ void *QFontEngine::harfbuzzFont() const
{
Q_ASSERT(type() != QFontEngine::Multi);
#ifdef QT_ENABLE_HARFBUZZ_NG
- if (useHarfbuzzNG)
+ if (qt_useHarfbuzzNG())
return hb_qt_font_get_for_engine(const_cast<QFontEngine *>(this));
#endif
if (!font_) {
@@ -318,7 +323,7 @@ void *QFontEngine::harfbuzzFace() const
{
Q_ASSERT(type() != QFontEngine::Multi);
#ifdef QT_ENABLE_HARFBUZZ_NG
- if (useHarfbuzzNG)
+ if (qt_useHarfbuzzNG())
return hb_qt_face_get_for_engine(const_cast<QFontEngine *>(this));
#endif
if (!face_) {
@@ -360,7 +365,7 @@ bool QFontEngine::supportsScript(QChar::Script script) const
#endif
#ifdef QT_ENABLE_HARFBUZZ_NG
- if (useHarfbuzzNG) {
+ if (qt_useHarfbuzzNG()) {
bool ret = false;
if (hb_face_t *face = hb_qt_face_get_for_engine(const_cast<QFontEngine *>(this))) {
hb_tag_t script_tag_1, script_tag_2;
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index 2e289e2bd8..b1205a8c85 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -910,8 +910,8 @@ QTextLayout *QTextCursorPrivate::blockLayout(QTextBlock &block) const{
select text. For selections see selectionStart(), selectionEnd(),
hasSelection(), clearSelection(), and removeSelectedText().
- If the position() is at the start of a block atBlockStart()
- returns \c true; and if it is at the end of a block atBlockEnd() returns
+ If the position() is at the start of a block, atBlockStart()
+ returns \c true; and if it is at the end of a block, atBlockEnd() returns
true. The format of the current character is returned by
charFormat(), and the format of the current block is returned by
blockFormat().
@@ -921,9 +921,9 @@ QTextLayout *QTextCursorPrivate::blockLayout(QTextBlock &block) const{
mergeBlockFormat() functions. The 'set' functions will replace the
cursor's current character or block format, while the 'merge'
functions add the given format properties to the cursor's current
- format. If the cursor has a selection the given format is applied
- to the current selection. Note that when only parts of a block is
- selected the block format is applied to the entire block. The text
+ format. If the cursor has a selection, the given format is applied
+ to the current selection. Note that when only a part of a block is
+ selected, the block format is applied to the entire block. The text
at the current character position can be turned into a list using
createList().
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index bd5877c924..91e01ffbb1 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -1172,7 +1172,7 @@ QString QTextDocument::toPlainText() const
/*!
Replaces the entire contents of the document with the given plain
- \a text.
+ \a text. The undo/redo history is reset when this function is called.
\sa setHtml()
*/
@@ -1190,7 +1190,8 @@ void QTextDocument::setPlainText(const QString &text)
/*!
Replaces the entire contents of the document with the given
- HTML-formatted text in the \a html string.
+ HTML-formatted text in the \a html string. The undo/redo history
+ is reset when this function is called.
The HTML formatting is respected as much as possible; for example,
"<b>bold</b> text" will produce text where the first word has a font
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index d6e9172e60..48e0550a61 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -938,7 +938,7 @@ void QTextEngine::shapeLine(const QScriptLine &line)
}
#ifdef QT_ENABLE_HARFBUZZ_NG
-extern bool useHarfbuzzNG; // defined in qfontengine.cpp
+extern bool qt_useHarfbuzzNG(); // defined in qfontengine.cpp
#endif
void QTextEngine::shapeText(int item) const
@@ -1051,7 +1051,7 @@ void QTextEngine::shapeText(int item) const
}
#ifdef QT_ENABLE_HARFBUZZ_NG
- if (Q_LIKELY(useHarfbuzzNG))
+ if (Q_LIKELY(qt_useHarfbuzzNG()))
si.num_glyphs = shapeTextWithHarfbuzzNG(si, string, itemLength, fontEngine, itemBoundaries, kerningEnabled);
else
#endif
@@ -1067,7 +1067,7 @@ void QTextEngine::shapeText(int item) const
QGlyphLayout glyphs = shapedGlyphs(&si);
#ifdef QT_ENABLE_HARFBUZZ_NG
- if (Q_LIKELY(useHarfbuzzNG))
+ if (Q_LIKELY(qt_useHarfbuzzNG()))
qt_getJustificationOpportunities(string, itemLength, si, glyphs, logClusters(&si));
#endif
@@ -1234,6 +1234,15 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st
}
#ifdef Q_OS_MAC
+ // CTRunGetPosition has a bug which applies matrix on 10.6, so we disable
+ // scaling the advances for this particular version
+ if (actualFontEngine->fontDef.stretch != 100
+ && QSysInfo::MacintoshVersion != QSysInfo::MV_10_6) {
+ QFixed stretch = QFixed(actualFontEngine->fontDef.stretch) / QFixed(100);
+ for (uint i = 0; i < num_glyphs; ++i)
+ g.advances[i] *= stretch;
+ }
+
if (actualFontEngine->fontDef.styleStrategy & QFont::ForceIntegerMetrics) {
for (uint i = 0; i < num_glyphs; ++i)
g.advances[i] = g.advances[i].round();
@@ -1604,7 +1613,7 @@ void QTextEngine::itemize() const
}
#ifdef QT_ENABLE_HARFBUZZ_NG
analysis = scriptAnalysis.data();
- if (useHarfbuzzNG) {
+ if (qt_useHarfbuzzNG()) {
// ### pretend HB-old behavior for now
for (int i = 0; i < length; ++i) {
switch (analysis[i].script) {
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index ab4b10522a..6d779d089d 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -1890,7 +1890,7 @@ void QTextCharFormat::setFont(const QFont &font)
If \a behavior is QTextCharFormat::FontPropertiesAll, the font property that
has not been explicitly set is treated like as it were set with default value;
- If \a behavior is QTextCharFormat::FontPropertiesAll, the font property that
+ If \a behavior is QTextCharFormat::FontPropertiesSpecifiedOnly, the font property that
has not been explicitly set is ignored and the respective property value
remains unchanged.
@@ -1928,7 +1928,7 @@ void QTextCharFormat::setFont(const QFont &font, FontPropertiesInheritanceBehavi
setFontFixedPitch(font.fixedPitch());
if (mask & QFont::CapitalizationResolved)
setFontCapitalization(font.capitalization());
- if (mask & QFont::LetterSpacingResolved)
+ if (mask & QFont::WordSpacingResolved)
setFontWordSpacing(font.wordSpacing());
if (mask & QFont::LetterSpacingResolved) {
setFontLetterSpacingType(font.letterSpacingType());