From 40a7f2c6469e1702e791c66414051fed385a7930 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 15 Aug 2019 08:55:49 +0200 Subject: distancefieldgenerator: Fix garbled text with large fonts on little endian When writing the texture index of each glyph into the font, we would first do toBigEndian() on an int and then truncate this to quint16, causing the texture index to be 0 for all glyphs on little endian systems. This would cause glyphs that were not located in the first texture to be garbled in the output. [ChangeLog][distancefieldgenerator] Fixed broken text rendering when generating large glyph sets. Task-number: QTBUG-77501 Change-Id: I7c2d31a6e57182f440d7f78bd6305109846ccb75 Reviewed-by: Simon Hausmann --- src/distancefieldgenerator/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/distancefieldgenerator/mainwindow.cpp b/src/distancefieldgenerator/mainwindow.cpp index 3717330b4..ee4475ada 100644 --- a/src/distancefieldgenerator/mainwindow.cpp +++ b/src/distancefieldgenerator/mainwindow.cpp @@ -551,7 +551,7 @@ QByteArray MainWindow::createSfntTable() glyphRecord.boundingRectY = qToBigEndian(TO_FIXED_POINT(glyphData.boundingRect.y())); glyphRecord.boundingRectWidth = qToBigEndian(TO_FIXED_POINT(glyphData.boundingRect.width())); glyphRecord.boundingRectHeight = qToBigEndian(TO_FIXED_POINT(glyphData.boundingRect.height())); - glyphRecord.textureIndex = qToBigEndian(glyphData.textureIndex); + glyphRecord.textureIndex = qToBigEndian(quint16(glyphData.textureIndex)); buffer.write(reinterpret_cast(&glyphRecord), sizeof(QtdfGlyphRecord)); int expectedWidth = qCeil(glyphData.texCoord.width + glyphData.texCoord.xMargin * 2); -- cgit v1.2.3 From 771fdc5b13f1b13c82eeaf513696b2e564326b80 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Mon, 19 Aug 2019 13:18:44 +0200 Subject: Fix applying font and option settings Move the code which applies changes to applyChanges() method. Fixes: QTBUG-77399 Change-Id: Ic4436ce65e246c518a6fcdfe119df772a0585468 Reviewed-by: Friedemann Kleint --- src/assistant/assistant/mainwindow.cpp | 2 +- src/assistant/assistant/preferencesdialog.cpp | 55 ++++++++++++--------------- src/assistant/assistant/preferencesdialog.h | 4 +- 3 files changed, 26 insertions(+), 35 deletions(-) diff --git a/src/assistant/assistant/mainwindow.cpp b/src/assistant/assistant/mainwindow.cpp index 2b9c87bbf..fc5fe5b3f 100644 --- a/src/assistant/assistant/mainwindow.cpp +++ b/src/assistant/assistant/mainwindow.cpp @@ -842,7 +842,7 @@ void MainWindow::showPreferences() m_centralWidget, &CentralWidget::updateBrowserFont); connect(&dia, &PreferencesDialog::updateUserInterface, m_centralWidget, &CentralWidget::updateUserInterface); - dia.showDialog(); + dia.exec(); } void MainWindow::syncContents() diff --git a/src/assistant/assistant/preferencesdialog.cpp b/src/assistant/assistant/preferencesdialog.cpp index 7955e08df..67f91326c 100644 --- a/src/assistant/assistant/preferencesdialog.cpp +++ b/src/assistant/assistant/preferencesdialog.cpp @@ -142,31 +142,6 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) setFont(helpEngine.appFont()); } -PreferencesDialog::~PreferencesDialog() -{ - if (m_appFontChanged) { - helpEngine.setAppFont(m_appFontPanel->selectedFont()); - helpEngine.setUseAppFont(m_appFontPanel->isChecked()); - helpEngine.setAppWritingSystem(m_appFontPanel->writingSystem()); - emit updateApplicationFont(); - } - - if (m_browserFontChanged) { - helpEngine.setBrowserFont(m_browserFontPanel->selectedFont()); - helpEngine.setUseBrowserFont(m_browserFontPanel->isChecked()); - helpEngine.setBrowserWritingSystem(m_browserFontPanel->writingSystem()); - emit updateBrowserFont(); - } - - QString homePage = m_ui.homePageLineEdit->text(); - if (homePage.isEmpty()) - homePage = QLatin1String("help"); - helpEngine.setHomePage(homePage); - - int option = m_ui.helpStartComboBox->currentIndex(); - helpEngine.setStartOption(option); -} - FilterSetup PreferencesDialog::readOriginalSetup() const { FilterSetup filterSetup; @@ -195,12 +170,6 @@ FilterSetup PreferencesDialog::readOriginalSetup() const return filterSetup; } -void PreferencesDialog::showDialog() -{ - if (exec() != Accepted) - m_appFontChanged = m_browserFontChanged = false; -} - void PreferencesDialog::updateFilterPage() { if (m_hideFiltersTab) @@ -563,6 +532,30 @@ void PreferencesDialog::applyChanges() helpEngine.setShowTabs(m_ui.showTabs->isChecked()); if (m_showTabs != m_ui.showTabs->isChecked()) emit updateUserInterface(); + + if (m_appFontChanged) { + helpEngine.setAppFont(m_appFontPanel->selectedFont()); + helpEngine.setUseAppFont(m_appFontPanel->isChecked()); + helpEngine.setAppWritingSystem(m_appFontPanel->writingSystem()); + emit updateApplicationFont(); + m_appFontChanged = false; + } + + if (m_browserFontChanged) { + helpEngine.setBrowserFont(m_browserFontPanel->selectedFont()); + helpEngine.setUseBrowserFont(m_browserFontPanel->isChecked()); + helpEngine.setBrowserWritingSystem(m_browserFontPanel->writingSystem()); + emit updateBrowserFont(); + m_browserFontChanged = false; + } + + QString homePage = m_ui.homePageLineEdit->text(); + if (homePage.isEmpty()) + homePage = QLatin1String("help"); + helpEngine.setHomePage(homePage); + + const int option = m_ui.helpStartComboBox->currentIndex(); + helpEngine.setStartOption(option); } void PreferencesDialog::updateFontSettingsPage() diff --git a/src/assistant/assistant/preferencesdialog.h b/src/assistant/assistant/preferencesdialog.h index 89c30c568..1ff39e326 100644 --- a/src/assistant/assistant/preferencesdialog.h +++ b/src/assistant/assistant/preferencesdialog.h @@ -29,6 +29,7 @@ #ifndef PREFERENCESDIALOG_H #define PREFERENCESDIALOG_H +#include #include #include #include "ui_preferencesdialog.h" @@ -60,9 +61,6 @@ class PreferencesDialog : public QDialog public: PreferencesDialog(QWidget *parent = nullptr); - ~PreferencesDialog() override; - - void showDialog(); private slots: void filterSelected(QListWidgetItem *item); -- cgit v1.2.3 From 6a5fb1ef73fc7a917efe3670fcdfa7aa6e09df86 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 13 Aug 2019 13:26:48 +0200 Subject: qdoc: Avoid errors related to PCH usage Remove whitespace from the default parameters passed to Clang, and add '-ferror-limit=0' to disable the error limit. This helps to ensure we get a usable precompiled header on all platforms. Another issue that manifested on Windows was the order in which the (temporary) module header and the PCH was built - after writing the module header, its QFile was closed at the end of the function scope, and it received a timestamp later than the PCH. Some versions of libclang see this (rightfully) as a problem. Close the module header file handle before generating the PCH. Task-number: QTBUG-75053 Change-Id: I61d066c40eddfdfdcc4c8cd847f6bec40652f9e0 Reviewed-by: Paul Wicking --- src/qdoc/clangcodeparser.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp index b7f9e86ad..b628c4cd1 100644 --- a/src/qdoc/clangcodeparser.cpp +++ b/src/qdoc/clangcodeparser.cpp @@ -1125,13 +1125,14 @@ static const char *defaultArgs_[] = { "-DQ_QDOC", "-DQ_CLANG_QDOC", "-DQT_DISABLE_DEPRECATED_BEFORE=0", - "-DQT_ANNOTATE_CLASS(type,...)=static_assert(sizeof(#__VA_ARGS__), #type);", - "-DQT_ANNOTATE_CLASS2(type,a1,a2)=static_assert(sizeof(#a1, #a2), #type);", + "-DQT_ANNOTATE_CLASS(type,...)=static_assert(sizeof(#__VA_ARGS__),#type);", + "-DQT_ANNOTATE_CLASS2(type,a1,a2)=static_assert(sizeof(#a1,#a2),#type);", "-DQT_ANNOTATE_FUNCTION(a)=__attribute__((annotate(#a)))", "-DQT_ANNOTATE_ACCESS_SPECIFIER(a)=__attribute__((annotate(#a)))", "-Wno-constant-logical-operand", "-Wno-macro-redefined", "-Wno-nullability-completeness", + "-ferror-limit=0", "-I" CLANG_RESOURCE_DIR }; @@ -1302,6 +1303,7 @@ void ClangCodeParser::buildPCH() out << line << "\n"; } } + tmpHeaderFile.close(); } if (printParsingErrors_ == 0) Location::logToStdErrAlways("clang not printing errors; include paths were guessed"); -- cgit v1.2.3