summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorIikka Eklund <iikka.eklund@digia.com>2014-04-01 11:44:26 +0300
committerIikka Eklund <iikka.eklund@digia.com>2014-04-01 11:44:27 +0300
commit0ab63b035a649dc1982c867cd37d466d249004b9 (patch)
tree6de22edcd3957aae3eee698136a000e52ab7f8fe /src/gui/text
parenta6f8aa0ae1d5a1d1099df1891ea60b14b6eb6065 (diff)
parent0cb2c760c219514849ab0f6be8e5368f92dfa5d9 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qfont.cpp8
-rw-r--r--src/gui/text/qfont.h6
-rw-r--r--src/gui/text/qfont_p.h2
-rw-r--r--src/gui/text/qfontdatabase.cpp2
-rw-r--r--src/gui/text/qharfbuzzng.cpp59
-rw-r--r--src/gui/text/qrawfont.cpp5
6 files changed, 38 insertions, 44 deletions
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 0fffa608a4..1797905e93 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -546,6 +546,7 @@ QFontEngineData::~QFontEngineData()
/*!
\fn QString QFont::rawName() const
+ \deprecated
Returns the name of the font within the underlying window system.
@@ -559,6 +560,7 @@ QFontEngineData::~QFontEngineData()
/*!
\fn void QFont::setRawName(const QString &name)
+ \deprecated
Sets a font by its system specific name.
@@ -1106,7 +1108,7 @@ int QFont::weight() const
Qt uses a weighting scale from 0 to 99 similar to, but not the
same as, the scales used in Windows or CSS. A weight of 0 is
- ultralight, whilst 99 will be an extremely black.
+ ultralight, whilst 99 will be extremely black.
This enum contains the predefined font weights:
@@ -1282,7 +1284,7 @@ bool QFont::kerning() const
When kerning is enabled, glyph metrics do not add up anymore,
even for Latin text. In other words, the assumption that
width('a') + width('b') is equal to width("ab") is not
- neccesairly true.
+ necessarily true.
\sa kerning(), QFontMetrics
*/
@@ -2420,7 +2422,7 @@ QString QFontInfo::family() const
\since 4.8
Returns the style name of the matched window system font on
- system that supports it.
+ systems that support it.
\sa QFont::styleName()
*/
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index a207a1d60e..7fbaf24861 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -242,9 +242,11 @@ public:
{ qSwap(d, other.d); qSwap(resolve_mask, other.resolve_mask); return *this; }
#endif
+#if QT_DEPRECATED_SINCE(5, 3)
// needed for X11
- void setRawName(const QString &);
- QString rawName() const;
+ QT_DEPRECATED void setRawName(const QString &);
+ QT_DEPRECATED QString rawName() const;
+#endif
QString key() const;
diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h
index da24c6cb67..be0402b95a 100644
--- a/src/gui/text/qfont_p.h
+++ b/src/gui/text/qfont_p.h
@@ -251,7 +251,7 @@ public:
return script == other.script
&& screen == other.screen
&& multi == other.multi
- && (!multi || def.fallBackFamilies.size() == other.def.fallBackFamilies.size())
+ && (!multi || def.fallBackFamilies == other.def.fallBackFamilies)
&& def == other.def;
}
};
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index ae7b6c1c0d..558258c30e 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -531,7 +531,7 @@ static const int scriptForWritingSystem[] = {
Q_STATIC_ASSERT(sizeof(scriptForWritingSystem) / sizeof(scriptForWritingSystem[0]) == QFontDatabase::WritingSystemsCount);
-int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSystem)
+Q_GUI_EXPORT int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSystem)
{
return scriptForWritingSystem[writingSystem];
}
diff --git a/src/gui/text/qharfbuzzng.cpp b/src/gui/text/qharfbuzzng.cpp
index 1258ea9a78..b0bade83ee 100644
--- a/src/gui/text/qharfbuzzng.cpp
+++ b/src/gui/text/qharfbuzzng.cpp
@@ -264,16 +264,12 @@ _hb_qt_unicode_compose(hb_unicode_funcs_t * /*ufuncs*/,
// ### optimize
QString s = QString::fromUcs4(&a, 1) + QString::fromUcs4(&b, 1);
QString normalized = s.normalized(QString::NormalizationForm_C);
- if (normalized.isEmpty())
- return false;
- QVector<uint> ucs4str = normalized.toUcs4();
- if (ucs4str.size() == 1) {
- *ab = ucs4str.at(0);
- return true;
- }
+ QStringIterator it(normalized);
+ Q_ASSERT(it.hasNext()); // size>0
+ *ab = it.next();
- return false;
+ return !it.hasNext(); // size==1
}
static hb_bool_t
@@ -287,29 +283,28 @@ _hb_qt_unicode_decompose(hb_unicode_funcs_t * /*ufuncs*/,
return false;
QString normalized = QChar::decomposition(ab);
- Q_ASSERT(!normalized.isEmpty());
+ if (normalized.isEmpty())
+ return false;
- const QVector<uint> ucs4str = normalized.toUcs4();
- Q_ASSERT(ucs4str.size() <= HB_UNICODE_MAX_DECOMPOSITION_LEN);
+ QStringIterator it(normalized);
+ Q_ASSERT(it.hasNext()); // size>0
+ *a = it.next();
- if (ucs4str.size() == 1) {
- *a = ucs4str.at(0);
+ if (!it.hasNext()) { // size==1
*b = 0;
return *a != ab;
}
- if (ucs4str.size() == 2) {
- *a = ucs4str.at(0);
- *b = ucs4str.at(1);
-
+ // size>1
+ *b = it.next();
+ if (!it.hasNext()) { // size==2
// Here's the ugly part: if ab decomposes to a single character and
// that character decomposes again, we have to detect that and undo
// the second part :-(
- QString recomposed = normalized.normalized(QString::NormalizationForm_C);
- if (recomposed.isEmpty() || recomposed == normalized)
- return false;
-
- hb_codepoint_t c = recomposed.toUcs4().at(0);
+ const QString recomposed = normalized.normalized(QString::NormalizationForm_C);
+ QStringIterator jt(recomposed);
+ Q_ASSERT(jt.hasNext()); // size>0
+ const hb_codepoint_t c = jt.next();
if (c != *a && c != ab) {
*a = c;
*b = 0;
@@ -317,17 +312,18 @@ _hb_qt_unicode_decompose(hb_unicode_funcs_t * /*ufuncs*/,
return true;
}
+ // size>2
// If decomposed to more than two characters, take the last one,
// and recompose the rest to get the first component
- *b = ucs4str.last();
- normalized.chop(1);
- QString recomposed = normalized.normalized(QString::NormalizationForm_C);
- if (recomposed.isEmpty() || recomposed == normalized)
- return false;
-
+ do {
+ *b = it.next();
+ } while (it.hasNext());
+ normalized.chop(QChar::requiresSurrogates(*b) ? 2 : 1);
+ const QString recomposed = normalized.normalized(QString::NormalizationForm_C);
+ QStringIterator jt(recomposed);
+ Q_ASSERT(jt.hasNext()); // size>0
// We expect that recomposed has exactly one character now
- *a = recomposed.toUcs4().at(0);
-
+ *a = jt.next();
return true;
}
@@ -337,9 +333,6 @@ _hb_qt_unicode_decompose_compatibility(hb_unicode_funcs_t * /*ufuncs*/,
hb_codepoint_t *decomposed,
void * /*user_data*/)
{
- if (QChar::decompositionTag(u) == QChar::NoDecomposition) // !NFKD
- return 0;
-
const QString normalized = QChar::decomposition(u);
uint outlen = 0;
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index 2ba350fb67..f789ec596b 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -700,10 +700,7 @@ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writ
if (fe != 0 && fe->type() == QFontEngine::Multi) {
QFontEngineMulti *multiEngine = static_cast<QFontEngineMulti *>(fe);
fe = multiEngine->engine(0);
- if (fe == 0) {
- multiEngine->loadEngine(0);
- fe = multiEngine->engine(0);
- }
+ Q_ASSERT(fe);
}
if (fe != 0) {