summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2016-08-22 11:30:00 +0200
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2016-08-22 11:30:01 +0200
commitd314819fc02139e05e16c56657898c704f7fb48f (patch)
treea61ba968233634948401c8339f9613844de1c2b5 /src/gui/text
parent9f888d2fde9c5413e5519e0914e9b13638760985 (diff)
parente0e9e196a72ffe5457034894eaaadc90ed0d34ef (diff)
Merge dev into 5.8
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qcssparser.cpp20
-rw-r--r--src/gui/text/qfont.cpp4
-rw-r--r--src/gui/text/qfontdatabase.cpp3
-rw-r--r--src/gui/text/qfontengine_ft.cpp6
-rw-r--r--src/gui/text/qrawfont.cpp2
-rw-r--r--src/gui/text/qtextengine.cpp9
-rw-r--r--src/gui/text/qtextformat.cpp2
-rw-r--r--src/gui/text/qzip.cpp10
-rw-r--r--src/gui/text/text.pri2
9 files changed, 35 insertions, 23 deletions
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index 3e36a6d1c9..4548b6f8b9 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -403,8 +403,8 @@ ValueExtractor::ValueExtractor(const QVector<Declaration> &decls, const QPalette
LengthData ValueExtractor::lengthValue(const Value& v)
{
- QString s = v.variant.toString();
- s.reserve(s.length());
+ const QString str = v.variant.toString();
+ QStringRef s(&str);
LengthData data;
data.unit = LengthData::None;
if (s.endsWith(QLatin1String("px"), Qt::CaseInsensitive))
@@ -1442,11 +1442,13 @@ bool Declaration::realValue(qreal *real, const char *unit) const
const Value &v = d->values.at(0);
if (unit && v.type != Value::Length)
return false;
- QString s = v.variant.toString();
+ const QString str = v.variant.toString();
+ QStringRef s(&str);
if (unit) {
- if (!s.endsWith(QLatin1String(unit), Qt::CaseInsensitive))
+ const QLatin1String unitStr(unit);
+ if (!s.endsWith(unitStr, Qt::CaseInsensitive))
return false;
- s.chop(qstrlen(unit));
+ s.chop(unitStr.size());
}
bool ok = false;
qreal val = s.toDouble(&ok);
@@ -1459,11 +1461,13 @@ static bool intValueHelper(const QCss::Value &v, int *i, const char *unit)
{
if (unit && v.type != Value::Length)
return false;
- QString s = v.variant.toString();
+ const QString str = v.variant.toString();
+ QStringRef s(&str);
if (unit) {
- if (!s.endsWith(QLatin1String(unit), Qt::CaseInsensitive))
+ const QLatin1String unitStr(unit);
+ if (!s.endsWith(unitStr, Qt::CaseInsensitive))
return false;
- s.chop(qstrlen(unit));
+ s.chop(unitStr.size());
}
bool ok = false;
int val = s.toInt(&ok);
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 37b8c22920..3b24039ea6 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -730,7 +730,7 @@ void QFont::setFamily(const QString &family)
Returns the requested font style name, it will be used to match the
font with irregular styles (that can't be normalized in other style
properties). It depends on system font support, thus only works for
- OS X and X11 so far. On Windows irregular styles will be added
+ \macos and X11 so far. On Windows irregular styles will be added
as separate font families so there is no need for this.
\sa setFamily(), setStyle()
@@ -825,7 +825,7 @@ int QFont::pointSize() const
\li Vertical hinting (light)
\li Full hinting
\row
- \li Cocoa on OS X
+ \li Cocoa on \macos
\li No hinting
\li No hinting
\li No hinting
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index cb1619e690..e8f29ce520 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -2048,7 +2048,7 @@ bool QFontDatabase::hasFamily(const QString &family) const
Returns \c true if and only if the \a family font family is private.
- This happens, for instance, on OS X and iOS, where the system UI fonts are not
+ This happens, for instance, on \macos and iOS, where the system UI fonts are not
accessible to the user. For completeness, QFontDatabase::families() returns all
font families, including the private ones. You should use this function if you
are developing a font selection control in order to keep private fonts hidden.
@@ -2810,6 +2810,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
req.fallBackFamilies.clear();
}
+ Q_ASSERT(fe);
if (fe->symbol || (d->request.styleStrategy & QFont::NoFontMerging)) {
for (int i = 0; i < QChar::ScriptCount; ++i) {
if (!d->engineData->engines[i]) {
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index ca6d33c7aa..46f5e6c070 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -1830,7 +1830,7 @@ glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixe
static inline QImage alphaMapFromGlyphData(QFontEngineFT::Glyph *glyph, QFontEngine::GlyphFormat glyphFormat)
{
- if (glyph == Q_NULLPTR)
+ if (glyph == Q_NULLPTR || glyph->height == 0 || glyph->width == 0)
return QImage();
QImage::Format format = QImage::Format_Invalid;
@@ -1878,11 +1878,15 @@ QImage *QFontEngineFT::lockedAlphaMapForGlyph(glyph_t glyphIndex, QFixed subPixe
currentlyLockedAlphaMap = alphaMapFromGlyphData(glyph, neededFormat);
+ const bool glyphHasGeometry = glyph != Q_NULLPTR && glyph->height != 0 && glyph->width != 0;
if (!cacheEnabled && glyph != &emptyGlyph) {
currentlyLockedAlphaMap = currentlyLockedAlphaMap.copy();
delete glyph;
}
+ if (!glyphHasGeometry)
+ return Q_NULLPTR;
+
if (currentlyLockedAlphaMap.isNull())
return QFontEngine::lockedAlphaMapForGlyph(glyphIndex, subPixelPosition, neededFormat, t, offset);
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index 1fbe0ce9d1..8e6ffa5e94 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -86,7 +86,7 @@ QT_BEGIN_NAMESPACE
also have accessors to some relevant data in the physical font.
QRawFont only provides support for the main font technologies: GDI and DirectWrite on Windows
- platforms, FreeType on Linux platforms and CoreText on OS X. For other
+ platforms, FreeType on Linux platforms and CoreText on \macos. For other
font back-ends, the APIs will be disabled.
QRawFont can be constructed in a number of ways:
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 1aaacdd00d..8a13455ee0 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1567,12 +1567,13 @@ void QTextEngine::validate() const
layoutData = new LayoutData();
if (block.docHandle()) {
layoutData->string = block.text();
- if (block.next().isValid()) {
- if (option.flags() & QTextOption::ShowLineAndParagraphSeparators)
- layoutData->string += QChar(0xb6);
- } else if (option.flags() & QTextOption::ShowDocumentTerminator) {
+ const bool nextBlockValid = block.next().isValid();
+ if (!nextBlockValid && option.flags() & QTextOption::ShowDocumentTerminator) {
layoutData->string += QChar(0xA7);
+ } else if (option.flags() & QTextOption::ShowLineAndParagraphSeparators) {
+ layoutData->string += QLatin1Char(nextBlockValid ? 0xb6 : 0x20);
}
+
} else {
layoutData->string = text;
}
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 2109b15a85..8adeb3e659 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -1335,7 +1335,7 @@ bool QTextFormat::operator==(const QTextFormat &rhs) const
\value WaveUnderline The text is underlined using a wave shaped line.
\value SpellCheckUnderline The underline is drawn depending on the QStyle::SH_SpellCeckUnderlineStyle
style hint of the QApplication style. By default this is mapped to
- WaveUnderline, on OS X it is mapped to DashDotLine.
+ WaveUnderline, on \macos it is mapped to DashDotLine.
\sa Qt::PenStyle
*/
diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp
index 7cb89543ba..b68c36fd9e 100644
--- a/src/gui/text/qzip.cpp
+++ b/src/gui/text/qzip.cpp
@@ -498,11 +498,13 @@ QZipReader::FileInfo QZipPrivate::fillFileInfo(int index) const
// fix the file path, if broken (convert separators, eat leading and trailing ones)
fileInfo.filePath = QDir::fromNativeSeparators(fileInfo.filePath);
- while (!fileInfo.filePath.isEmpty() && (fileInfo.filePath.at(0) == QLatin1Char('.') || fileInfo.filePath.at(0) == QLatin1Char('/')))
- fileInfo.filePath = fileInfo.filePath.mid(1);
- while (!fileInfo.filePath.isEmpty() && fileInfo.filePath.at(fileInfo.filePath.size() - 1) == QLatin1Char('/'))
- fileInfo.filePath.chop(1);
+ QStringRef filePathRef(&fileInfo.filePath);
+ while (filePathRef.startsWith(QLatin1Char('.')) || filePathRef.startsWith(QLatin1Char('/')))
+ filePathRef = filePathRef.mid(1);
+ while (filePathRef.endsWith(QLatin1Char('/')))
+ filePathRef.chop(1);
+ fileInfo.filePath = filePathRef.toString();
return fileInfo;
}
diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri
index be60ba72cc..3fe47a6645 100644
--- a/src/gui/text/text.pri
+++ b/src/gui/text/text.pri
@@ -85,7 +85,7 @@ SOURCES += \
HEADERS += \
text/qplatformfontdatabase.h
-contains(QT_CONFIG, harfbuzz)|contains(QT_CONFIG, system-harfbuzz) {
+qtConfig(harfbuzz)|qtConfig(system-harfbuzz) {
DEFINES += QT_ENABLE_HARFBUZZ_NG
include($$PWD/../../3rdparty/harfbuzz_dependency.pri)