From fb9a1cdf638145c5003ee18da71e28e424f91b77 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 23 May 2019 11:17:11 +0200 Subject: Bump version Change-Id: I431c0fe718d173a6c45ade6b17b461586a5f0ca7 --- .qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.qmake.conf b/.qmake.conf index 1bf9543ac..f1a6177b6 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,3 +1,3 @@ load(qt_build_config) -MODULE_VERSION = 5.12.3 +MODULE_VERSION = 5.12.4 -- cgit v1.2.1 From af241efd145cd6e9c8b8b4107fc0a7b78da16c4c Mon Sep 17 00:00:00 2001 From: Antti Kokko Date: Thu, 23 May 2019 15:20:43 +0300 Subject: Add changes file for Qt 5.12.4 Change-Id: I95212a61dddc2f4bc0a7e3700c52679986188b77 Reviewed-by: Lucie Gerard Reviewed-by: Friedemann Kleint Reviewed-by: Kai Koehne --- dist/changes-5.12.4 | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 dist/changes-5.12.4 diff --git a/dist/changes-5.12.4 b/dist/changes-5.12.4 new file mode 100644 index 000000000..4796a3828 --- /dev/null +++ b/dist/changes-5.12.4 @@ -0,0 +1,33 @@ +Qt 5.12.4 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.12.0 through 5.12.3. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +https://doc.qt.io/qt-5/index.html + +The Qt version 5.12 series is binary compatible with the 5.11.x series. +Applications compiled for 5.11 will continue to run with 5.12. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* lupdate * +**************************************************************************** + + - lupdate will now generate an error if it is asked to update a .ts file + with translations, but without a target language. This is to ensure that + plural translations are not destroyed. + +**************************************************************************** +* qdoc * +**************************************************************************** + + - [QTBUG-73058] qdoc now uses #! as a snippet marker in .cmake, + CMakeLists.txt files. -- cgit v1.2.1 From fcb96af0215a9ae070face3997cdf84dafc057e5 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 17 Jun 2019 08:33:22 +0200 Subject: distancefieldgenerator: Fix cmap error for some fonts We would accidentally use the raw field from the font without converting its endianness, thus we would sanity check against the wrong length and print out error messages for some perfectly valid cmap subtables. [ChangeLog][distancefieldgenerator] Fixed bug where the tool would fail for valid fonts with the message "end of cmap table reached when parsing subtable". Task-number: QTBUG-76188 Change-Id: I7f84f4e161da705b49423ed3cc16a78cee67c607 Reviewed-by: Simon Hausmann --- src/distancefieldgenerator/distancefieldmodelworker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/distancefieldgenerator/distancefieldmodelworker.cpp b/src/distancefieldgenerator/distancefieldmodelworker.cpp index 373cb05ab..d140ff219 100644 --- a/src/distancefieldgenerator/distancefieldmodelworker.cpp +++ b/src/distancefieldgenerator/distancefieldmodelworker.cpp @@ -129,7 +129,7 @@ static void readCmapSubtable(DistanceFieldModelWorker *worker, const QByteArray return; } - const void *end = cmap.constData() + tableOffset + subtable->length; + const void *end = cmap.constData() + tableOffset + length; worker->readCmapSubtable(subtable, end); } -- cgit v1.2.1 From 8e7db0dd1cdc63c962359b37f882643dd3ed0e1a Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 20 Jun 2019 09:55:40 +0200 Subject: distancefieldgenerator: Avoid exceeding max texture size Since we use a single area allocator for all textures, a glyph on the edge between two textures, would end up spanning two textures. It would be assigned to the first, and which in turn would be expanded to account for the additional data. The result was that the texture height exceeded the maximum size set. This is actually an inherited problem from Qt Quick, but it happens more frequently with the distancefieldgenerator because you will typically generate a large number of glyphs, and also the default max size set is quite low to be on the safe side. The bandaid in this patch is to pad the texture height by the size of one glyph, which will for the most part get rid of the problem, except for fonts where a majority of glyphs exceed the em square. [ChangeLog][distancefieldgenerator] Fixed a bug where the generated textures might exceed the maximum height. Task-number: QTBUG-76528 Change-Id: I51487bbf7c46556b022bfd45cefc8776d0272de3 Reviewed-by: Simon Hausmann --- src/distancefieldgenerator/mainwindow.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/distancefieldgenerator/mainwindow.cpp b/src/distancefieldgenerator/mainwindow.cpp index 763aeaa6b..a3f48cb0a 100644 --- a/src/distancefieldgenerator/mainwindow.cpp +++ b/src/distancefieldgenerator/mainwindow.cpp @@ -417,10 +417,20 @@ QByteArray MainWindow::createSfntTable() header.minorVersion = 12; header.pixelSize = qToBigEndian(quint16(qRound(m_model->pixelSize()))); + const quint8 padding = 2; + qreal scaleFactor = qreal(1) / QT_DISTANCEFIELD_SCALE(m_model->doubleGlyphResolution()); + const int radius = QT_DISTANCEFIELD_RADIUS(m_model->doubleGlyphResolution()) + / QT_DISTANCEFIELD_SCALE(m_model->doubleGlyphResolution()); + quint32 textureSize = ui->sbMaximumTextureSize->value(); + + // Since we are using a single area allocator that spans all textures, we need + // to split the textures one row before the actual maximum size, otherwise + // glyphs that fall on the edge between two textures will expand the texture + // they are assigned to, and this will end up being larger than the max. + textureSize -= quint32(qCeil(m_model->pixelSize() * scaleFactor) + radius * 2 + padding * 2); header.textureSize = qToBigEndian(textureSize); - const quint8 padding = 2; header.padding = padding; header.flags = m_model->doubleGlyphResolution() ? 1 : 0; header.numGlyphs = qToBigEndian(quint32(list.size())); @@ -443,13 +453,9 @@ QByteArray MainWindow::createSfntTable() int textureCount = 0; { - qreal scaleFactor = qreal(1) / QT_DISTANCEFIELD_SCALE(m_model->doubleGlyphResolution()); QTransform scaleDown; scaleDown.scale(scaleFactor, scaleFactor); - const int radius = QT_DISTANCEFIELD_RADIUS(m_model->doubleGlyphResolution()) - / QT_DISTANCEFIELD_SCALE(m_model->doubleGlyphResolution()); - { bool foundOptimalSize = false; while (!foundOptimalSize) { @@ -466,6 +472,7 @@ QByteArray MainWindow::createSfntTable() glyphData.boundingRect = scaleDown.mapRect(path.boundingRect()); int glyphWidth = qCeil(glyphData.boundingRect.width()) + radius * 2; int glyphHeight = qCeil(glyphData.boundingRect.height()) + radius * 2; + glyphData.glyphSize = QSize(glyphWidth + padding * 2, glyphHeight + padding * 2); if (glyphData.glyphSize.width() > qint32(textureSize) -- cgit v1.2.1 From d7e346b58260b24e02c64f82b2900bfba5951330 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 20 Jun 2019 10:05:17 +0200 Subject: distancefieldgenerator: Remove unused variable The total allocated area was never used. Change-Id: I1aad1d4349ec94e2ccc521903b304270decd1d0d Reviewed-by: Simon Hausmann --- src/distancefieldgenerator/mainwindow.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/distancefieldgenerator/mainwindow.cpp b/src/distancefieldgenerator/mainwindow.cpp index a3f48cb0a..94f5c8ebb 100644 --- a/src/distancefieldgenerator/mainwindow.cpp +++ b/src/distancefieldgenerator/mainwindow.cpp @@ -438,7 +438,6 @@ QByteArray MainWindow::createSfntTable() sizeof(QtdfHeader)); // Maximum height allocator to find optimal number of textures - QRect allocatedArea; QVector allocatedAreaPerTexture; struct GlyphData { @@ -496,7 +495,6 @@ QByteArray MainWindow::createSfntTable() rect.width(), rect.height()); - allocatedArea |= rect; glyphData.texCoord.xMargin = QT_DISTANCEFIELD_RADIUS(m_model->doubleGlyphResolution()) / qreal(QT_DISTANCEFIELD_SCALE(m_model->doubleGlyphResolution())); glyphData.texCoord.yMargin = QT_DISTANCEFIELD_RADIUS(m_model->doubleGlyphResolution()) / qreal(QT_DISTANCEFIELD_SCALE(m_model->doubleGlyphResolution())); -- cgit v1.2.1 From a05eb132416fcce8eb6a9fb240d0867796ed9deb Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 20 Jun 2019 10:26:38 +0200 Subject: distancefieldgenerator: Fix crash with multiple textures We need to make sure the allocated area starts at (0,0), since we allocate a texture at [width x height], and this would be too small if it did not also account for possible gaps at the top of the cache. This happens because glyphs may sometimes end up at the edge between two textures, in which case we will reserve space for them in the second of the two even though this is not needed. So this is a deficiency in the cache logic itself, but we need to at least make sure it does not crash. [ChangeLog][distancefieldgenerator] Fixed possible crash when generating large number of glyphs with a small texture size. Task-number: QTBUG-76188 Task-number: QTBUG-76528 Change-Id: I84c87c72985f5b621d120e7526cfe071555fa7f8 Reviewed-by: Simon Hausmann --- src/distancefieldgenerator/mainwindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/distancefieldgenerator/mainwindow.cpp b/src/distancefieldgenerator/mainwindow.cpp index 94f5c8ebb..3717330b4 100644 --- a/src/distancefieldgenerator/mainwindow.cpp +++ b/src/distancefieldgenerator/mainwindow.cpp @@ -488,14 +488,14 @@ QByteArray MainWindow::createSfntTable() break; glyphData.textureIndex = rect.y() / textureSize; - if (glyphData.textureIndex >= allocatedAreaPerTexture.size()) - allocatedAreaPerTexture.resize(glyphData.textureIndex + 1); + while (glyphData.textureIndex >= allocatedAreaPerTexture.size()) + allocatedAreaPerTexture.append(QRect(0, 0, 1, 1)); + allocatedAreaPerTexture[glyphData.textureIndex] |= QRect(rect.x(), rect.y() % textureSize, rect.width(), rect.height()); - glyphData.texCoord.xMargin = QT_DISTANCEFIELD_RADIUS(m_model->doubleGlyphResolution()) / qreal(QT_DISTANCEFIELD_SCALE(m_model->doubleGlyphResolution())); glyphData.texCoord.yMargin = QT_DISTANCEFIELD_RADIUS(m_model->doubleGlyphResolution()) / qreal(QT_DISTANCEFIELD_SCALE(m_model->doubleGlyphResolution())); glyphData.texCoord.x = rect.x() + padding; -- cgit v1.2.1 From 73ecd39debe850c11293fcf175c1e2b637edc5f3 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 19 Jun 2019 15:06:40 +0200 Subject: distancefieldgenerator: Fix failure reading CMAP for some fonts If all the range offsets in the type 4 subtable in CMAP is equal to 0, there is no need for a glyph ID array, so this array can actually have zero length. We did not account for this, and would fail to read those fonts. Task-number: QTBUG-76188 Change-Id: I11873fba7214d179af1fcd7ccff9a9fd1c72ce10 Reviewed-by: Simon Hausmann --- src/distancefieldgenerator/distancefieldmodelworker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/distancefieldgenerator/distancefieldmodelworker.cpp b/src/distancefieldgenerator/distancefieldmodelworker.cpp index d140ff219..b76f3b707 100644 --- a/src/distancefieldgenerator/distancefieldmodelworker.cpp +++ b/src/distancefieldgenerator/distancefieldmodelworker.cpp @@ -148,7 +148,7 @@ void DistanceFieldModelWorker::readCmapSubtable(const CmapSubtable4 *subtable, c const qint16 *idDeltas = reinterpret_cast(startCodes + segCount); const quint16 *idRangeOffsets = reinterpret_cast(idDeltas + segCount); const quint16 *glyphIdArray = idRangeOffsets + segCount; - if (glyphIdArray >= end) { + if (glyphIdArray > end) { emit error(tr("End of cmap table reached when parsing subtable format '4'")); return; } -- cgit v1.2.1 From 2ecbaa7c29de2350486c6e83375ba8c83fee6cda Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 16 May 2019 17:15:01 +0200 Subject: Qt Linguist: Document CMake macros Task-number: QTBUG-72159 Change-Id: I817e1d562675c0aa462706a1e90e758030ce7d1e Reviewed-by: Leena Miettinen --- src/linguist/linguist/doc/cmake-macros.qdoc | 114 +++++++++++++++++++++ .../doc/snippets/cmake-macros/examples.cmake | 13 +++ 2 files changed, 127 insertions(+) create mode 100644 src/linguist/linguist/doc/cmake-macros.qdoc create mode 100644 src/linguist/linguist/doc/snippets/cmake-macros/examples.cmake diff --git a/src/linguist/linguist/doc/cmake-macros.qdoc b/src/linguist/linguist/doc/cmake-macros.qdoc new file mode 100644 index 000000000..68eb849f5 --- /dev/null +++ b/src/linguist/linguist/doc/cmake-macros.qdoc @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page qtlinguist-cmake-qt5-add-translation.html +\ingroup cmake-macros-qtlinguisttools + +\title qt5_add_translation + +\brief Compiles Qt Linguist .ts files into .qm files. + +\section1 Synopsis + +\badcode +qt5_add_translation( file1.ts [file2.ts ...] + [OPTIONS ...]) +\endcode + +\section1 Description + +Calls \c{lrelease} on each \c{.ts} file passed as an argument, generating +\c{.qm} files. The paths of the generated files are added to \c{}. + +\section1 Options + +You can set additional \c{OPTIONS} that should be passed when \c{lrelease} is +invoked. You can find possible options in the \l{lrelease}{lrelease documentation}. + +By default, the \c{qm} files will be placed in the root level of the build +directory. To change this, you can set \c{OUTPUT_LOCATION} as a property +of the source \c{.ts} file. + +\section1 Examples + +Generating \c{helloworld_en.qm}, \c{helloworld_de.qm} in the build +directory: + +\snippet cmake-macros/examples.cmake qt5_add_translation + +Generating \c{helloworld_en.qm}, \c{helloworld_de.qm} in a \c{l10n} +sub-directory: + +\snippet cmake-macros/examples.cmake qt5_add_translation_output_location +*/ + +/*! +\page qtlinguist-cmake-qt5-create-translation.html +\ingroup cmake-macros-qtlinguisttools + +\title qt5_create_translation + +\brief Sets up the Qt Linguist translation toolchain. + +\section1 Synopsis + +\badcode +qt5_create_translation( ts-file-or-sources [ts-file-or-sources2 ...] + [OPTIONS ...]) +\endcode + +\section1 Description + +Processes given sources (directories or individual files) to generate +Qt Linguist \c{.ts} files. The \c{.ts} files are in turn compiled into \c{.qm} +files of the same base name that are stored in the build +directory. Paths to the generated \c{.qm} files are added to \c{}. + +The translation files to create or update need to have a \c{.ts} suffix. If +the given file path is not absolute it is resolved relative to the current +source directory. If no \c{.ts} file is passed as an argument, the macro +does nothing. + +Any arguments that do not have a \c{.ts} suffix are passed as input to the +\c{lupdate}. \c{lupdate} accepts directories and source files as input. +See also the \l{lupdate}{lupdate documentation} on further details. + +\section1 Options + +You can set additional \c{OPTIONS} that should be passed when \c{lupdate} is +invoked. You can find possible options in the \l{lupdate}{lupdate documentation}. + +\section1 Examples + +Recursively look up Qt translations from source files in current directory and +generate or update \c{helloworld_en.ts} and \c{helloworld_de.ts} file using +\c{lupdate}. Compile said files into \c{helloworld_en.qm} and \c{helloworld.de.qm} +files in the build directory: + +\snippet cmake-macros/examples.cmake qt5_create_translation +*/ diff --git a/src/linguist/linguist/doc/snippets/cmake-macros/examples.cmake b/src/linguist/linguist/doc/snippets/cmake-macros/examples.cmake new file mode 100644 index 000000000..542ba7a6f --- /dev/null +++ b/src/linguist/linguist/doc/snippets/cmake-macros/examples.cmake @@ -0,0 +1,13 @@ +#! [qt5_add_translation] +qt5_add_translation(qmFiles helloworld_en.ts helloworld_de.ts) +#! [qt5_add_translation] + +#! [qt5_add_translation_output_location] +set(TS_FILES helloworld_en.ts helloworld_de.ts) +set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "l10n") +qt5_add_translation(qmFiles ${TS_FILES}) +#! [qt5_add_translation_output_location] + +#! [qt5_create_translation] +qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} helloworld_en.ts helloworld_de.ts) +#! [qt5_create_translation] -- cgit v1.2.1 From e42dd0a13ebf37f7402a4cf09a6fb62b8c740c76 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Mon, 18 Mar 2019 13:39:57 +0100 Subject: qdoc: Avoid duplicating version strings in HTML element Commit 802aa37f introduced full version strings into the titles in HTML header. However, for pages that already included a prefix of the version information (e.g. 'Qt 5.13'), this meant that the version appeared now twice ('Qt 5.13 5.13.0'). This commit checks for the presence of a version prefix in the title and only appends the full version if one is not found or does not match with the project version (which for Qt modules is QT_VERSION). Fixes: QTBUG-74301 Change-Id: Iceb3cf8f0e0181709e547a87cb6e92a6a13dcfef Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> --- src/qdoc/htmlgenerator.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp index 23cd581e6..e5a5675f2 100644 --- a/src/qdoc/htmlgenerator.cpp +++ b/src/qdoc/htmlgenerator.cpp @@ -45,6 +45,7 @@ #include <qtextcodec.h> #include <quuid.h> #include <qmap.h> +#include <QtCore/qversionnumber.h> QT_BEGIN_NAMESPACE @@ -1953,8 +1954,6 @@ void HtmlGenerator::generateHeader(const QString& title, if (node && !node->doc().location().isEmpty()) out() << "<!-- " << node->doc().location().fileName() << " -->\n"; - QString projectVersion = qdb_->version(); - //determine the rest of the <title> element content: "title | titleSuffix version" QString titleSuffix; if (!landingtitle.isEmpty()) { @@ -1976,15 +1975,9 @@ void HtmlGenerator::generateHeader(const QString& title, //default: "title | Qt version" titleSuffix = QLatin1String("Qt "); - //for pages that duplicate the title and suffix (landing pages, home pages, - // and module landing pages, clear the duplicate if (title == titleSuffix) titleSuffix.clear(); - //for pages that duplicate the version, clear the duplicate - if (title.contains(projectVersion) || titleSuffix.contains(projectVersion)) - projectVersion.clear(); - QString divider; if (!titleSuffix.isEmpty() && !title.isEmpty()) divider = QLatin1String(" | "); @@ -1995,9 +1988,18 @@ void HtmlGenerator::generateHeader(const QString& title, << divider << titleSuffix; - if (!projectVersion.isEmpty()) - out() << QLatin1Char(' ') << projectVersion; - + // append a full version to the suffix if neither suffix nor title + // include (a prefix of) version information + QVersionNumber projectVersion = QVersionNumber::fromString(qdb_->version()); + if (!projectVersion.isNull()) { + QVersionNumber titleVersion; + QRegExp re("\\d+\\.\\d+"); + const QString &versionedTitle = titleSuffix.isEmpty() ? title : titleSuffix; + if (versionedTitle.contains(re)) + titleVersion = QVersionNumber::fromString(re.cap()); + if (titleVersion.isNull() || !titleVersion.isPrefixOf(projectVersion)) + out() << QLatin1Char(' ') << projectVersion.toString(); + } out() << "\n"; // Include style sheet and script links. -- cgit v1.2.1 From 18f9ac9e9489e48ea756bd89f6f40dd4499c42a3 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 14 Jun 2019 10:42:38 +0200 Subject: qdoc: Don't let qdoc run without a project name qdoc can't produce useful output if the project variable is not set in the qdocconf file. This update ensures that the project name is not empty. If it is empty, qdoc emits an error message in its log and terminates. Change-Id: Ic8d84987efe551651a06d720486960c4c62cb8a8 Reviewed-by: Paul Wicking --- src/qdoc/main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/qdoc/main.cpp b/src/qdoc/main.cpp index bb62a9160..ad089eb2e 100644 --- a/src/qdoc/main.cpp +++ b/src/qdoc/main.cpp @@ -242,6 +242,10 @@ static void processQdocconfFile(const QString &fileName) config.load(fileName); QString project = config.getString(CONFIG_PROJECT); QString moduleHeader = config.getString(CONFIG_MODULEHEADER); + if (project.isEmpty()) { + Location::logToStdErrAlways(QLatin1String("qdoc can't run; no project set in qdocconf file")); + exit(1); + } /* Add the defines to the configuration variables. */ -- cgit v1.2.1