add some fixes from upstream; more to follow
authormirabilos <tg@debian.org>
Sun, 12 Jul 2020 16:48:27 +0000 (18:48 +0200)
committermirabilos <mirabilos@evolvis.org>
Sun, 12 Jul 2020 16:48:27 +0000 (18:48 +0200)
debian/changelog
debian/patches/series
debian/patches/upstream/boldfonts-1.diff [new file with mode: 0644]
debian/patches/upstream/boldfonts-2.diff [new file with mode: 0644]
debian/patches/upstream/qt514-1.diff [new file with mode: 0644]
debian/patches/upstream/workspace-warning.diff [new file with mode: 0644]

index e504f07..a4d239f 100644 (file)
@@ -10,8 +10,12 @@ musescore (3.2.3+dfsg1-5) unstable; urgency=high
     - Work around #796257 to fix Debian reproducible builds
     - Don’t show irrelevant Qt5 deprecation warnings; upstream’s to fix
     - Forward and apply fixes by lintian
+  * Add some patches from upstream:
+    - Fix warning when loading custom workspaces
+    - Allow building against Qt 5.14 (Closes: #964641)
+    - Fix rendering of emboldened fonts
 
- -- Thorsten Glaser <tg@mirbsd.de>  Sun, 12 Jul 2020 18:28:56 +0200
+ -- Thorsten Glaser <tg@mirbsd.de>  Sun, 12 Jul 2020 18:47:13 +0200
 
 musescore (3.2.3+dfsg1-4) unstable; urgency=medium
 
index f81eaef..be94001 100644 (file)
@@ -12,6 +12,10 @@ upstream/fix-cli-audio.diff
 upstream/fix-pluginless-build.diff
 upstream/undoable-spacer-drag-length.diff
 upstream/workspace-crash.diff
+upstream/workspace-warning.diff
+upstream/qt514-1.diff
+upstream/boldfonts-1.diff
+upstream/boldfonts-2.diff
 experiments/statusline-concert-transposing-pitch.diff
 experiments/element-barbeat.diff
 #experiments/revert-restriking-patch.diff
diff --git a/debian/patches/upstream/boldfonts-1.diff b/debian/patches/upstream/boldfonts-1.diff
new file mode 100644 (file)
index 0000000..dfec69b
--- /dev/null
@@ -0,0 +1,88 @@
+Origin: vendor, commit:d5e7249f9a0742d4b9220246b03a0c7868480225
+Author: AntonioBL <antonio.lotti@alice.it>
+Description: fix #281601 and fix #284218 [workaround]: broken on-screen rendering of synthetically emboldened fonts
+
+--- a/libmscore/textbase.cpp
++++ b/libmscore/textbase.cpp
+@@ -519,8 +519,81 @@ void TextFragment::draw(QPainter* p, con
+       {
+       QFont f(font(t));
+       f.setPointSizeF(f.pointSizeF() * MScore::pixelRatio);
++#ifndef Q_OS_MACOS
++      qreal mm = p->worldTransform().m11();
++      if (!(MScore::pdfPrinting) && (mm < 1.0) && f.bold()) {
++            // workaround for https://musescore.org/en/node/284218
++            // and https://musescore.org/en/node/281601
++            // only needed for certain artificially emboldened fonts
++            // see https://musescore.org/en/node/281601#comment-900261
++            // in Qt 5.12.x this workaround should be no more necessary if
++            // env variable QT_MAX_CACHED_GLYPH_SIZE is set to 1
++            p->save();
++            qreal deviceLogicalDpi = (p->device()->logicalDpiX() + p->device()->logicalDpiY()) / 2.0;
++            QScreen* screen = QGuiApplication::primaryScreen();
++            qreal screenDpi = screen->logicalDotsPerInch();
++            qreal dx = p->worldTransform().dx();
++            qreal dy = p->worldTransform().dy();
++            // diagonal elements will now be changed to 1.0
++            p->setMatrix(QMatrix(1.0, 0.0, 0.0, 1.0, dx, dy));
++            // correction factor for bold text drawing, due to the change of the diagonal elements
++            qreal factor = 1.0 / mm;
++            QFont fold(f);
++            f.setPointSizeF(f.pointSizeF() / factor * deviceLogicalDpi / screenDpi);
++            QRawFont fRaw = QRawFont::fromFont(f);
++            QTextLayout textLayout(text);
++            textLayout.setFont(fold);
++            textLayout.beginLayout();
++            while (true) {
++                  QTextLine line = textLayout.createLine();
++                  if (!line.isValid())
++                        break;
++                  }
++            textLayout.endLayout();
++            // glyphruns with correct positions, but potentially wrong glyphs
++            // (see bug https://musescore.org/en/node/117191 regarding positions and DPI)
++            QList<QGlyphRun> glyphruns = textLayout.glyphRuns();
++            qreal offset = 0;
++            // glyphrun drawing has an offset equal to the max ascent of the text fragment
++            for (int i = 0; i < glyphruns.length(); i++) {
++                  qreal value = glyphruns.at(i).rawFont().ascent() / factor * deviceLogicalDpi / screenDpi;
++                  if (value > offset)
++                        offset = value;
++                  }
++            for (int i = 0; i < glyphruns.length(); i++) {
++                  QVector<QPointF> positions1 = glyphruns.at(i).positions();
++                  QVector<QPointF> positions2;
++                  // calculate the new positions for the scaled geometry
++                  for (int j = 0; j < positions1.length(); j++) {
++                        QPointF punto = positions1.at(j) / factor * deviceLogicalDpi / screenDpi;
++                        positions2.append(punto);
++                        }
++                  QGlyphRun glyphrun2 = glyphruns.at(i);
++                  glyphrun2.setPositions(positions2);
++                  // change the glyphs with the correct glyphs
++                  // and account for glyph substitution
++                  if (glyphrun2.rawFont().familyName() != f.family()) {
++                        QFont f2(f);
++                        f2.setFamily(glyphrun2.rawFont().familyName());
++                        glyphrun2.setRawFont(QRawFont::fromFont(f2));
++                        }
++                  else
++                        glyphrun2.setRawFont(fRaw);
++                  p->drawGlyphRun(QPointF(pos.x() / factor, pos.y() / factor - offset),glyphrun2);
++                  positions2.clear();
++                  }
++            // Restore the QPainter to its former state
++            p->setMatrix(QMatrix(mm, 0.0, 0.0, mm, dx, dy));
++            p->restore();
++            }
++      else {
++            p->setFont(f);
++            p->drawText(pos, text);
++            }
++#else
+       p->setFont(f);
+       p->drawText(pos, text);
++#endif
+       }
+ //---------------------------------------------------------
diff --git a/debian/patches/upstream/boldfonts-2.diff b/debian/patches/upstream/boldfonts-2.diff
new file mode 100644 (file)
index 0000000..84edeff
--- /dev/null
@@ -0,0 +1,71 @@
+Origin: vendor, commit:1cf3237fbcb6cdd9b53511fc2d7a57c16866da9a
+Author: AntonioBL <antonio.lotti@alice.it>
+Description: change default pdf dpi export to rendering value
+
+--- a/libmscore/textbase.cpp
++++ b/libmscore/textbase.cpp
+@@ -529,20 +529,16 @@ void TextFragment::draw(QPainter* p, con
+             // in Qt 5.12.x this workaround should be no more necessary if
+             // env variable QT_MAX_CACHED_GLYPH_SIZE is set to 1
+             p->save();
+-            qreal deviceLogicalDpi = (p->device()->logicalDpiX() + p->device()->logicalDpiY()) / 2.0;
+-            QScreen* screen = QGuiApplication::primaryScreen();
+-            qreal screenDpi = screen->logicalDotsPerInch();
+             qreal dx = p->worldTransform().dx();
+             qreal dy = p->worldTransform().dy();
+             // diagonal elements will now be changed to 1.0
+             p->setMatrix(QMatrix(1.0, 0.0, 0.0, 1.0, dx, dy));
+             // correction factor for bold text drawing, due to the change of the diagonal elements
+             qreal factor = 1.0 / mm;
+-            QFont fold(f);
+-            f.setPointSizeF(f.pointSizeF() / factor * deviceLogicalDpi / screenDpi);
+-            QRawFont fRaw = QRawFont::fromFont(f);
+-            QTextLayout textLayout(text);
+-            textLayout.setFont(fold);
++            QFont fnew(f, p->device());
++            fnew.setPointSizeF(f.pointSizeF() / factor);
++            QRawFont fRaw = QRawFont::fromFont(fnew);
++            QTextLayout textLayout(text, f, p->device());
+             textLayout.beginLayout();
+             while (true) {
+                   QTextLine line = textLayout.createLine();
+@@ -556,7 +552,7 @@ void TextFragment::draw(QPainter* p, con
+             qreal offset = 0;
+             // glyphrun drawing has an offset equal to the max ascent of the text fragment
+             for (int i = 0; i < glyphruns.length(); i++) {
+-                  qreal value = glyphruns.at(i).rawFont().ascent() / factor * deviceLogicalDpi / screenDpi;
++                  qreal value = glyphruns.at(i).rawFont().ascent() / factor;
+                   if (value > offset)
+                         offset = value;
+                   }
+@@ -565,15 +561,15 @@ void TextFragment::draw(QPainter* p, con
+                   QVector<QPointF> positions2;
+                   // calculate the new positions for the scaled geometry
+                   for (int j = 0; j < positions1.length(); j++) {
+-                        QPointF punto = positions1.at(j) / factor * deviceLogicalDpi / screenDpi;
+-                        positions2.append(punto);
++                        QPointF newPoint = positions1.at(j) / factor;
++                        positions2.append(newPoint);
+                         }
+                   QGlyphRun glyphrun2 = glyphruns.at(i);
+                   glyphrun2.setPositions(positions2);
+                   // change the glyphs with the correct glyphs
+                   // and account for glyph substitution
+-                  if (glyphrun2.rawFont().familyName() != f.family()) {
+-                        QFont f2(f);
++                  if (glyphrun2.rawFont().familyName() != fnew.family()) {
++                        QFont f2(fnew);
+                         f2.setFamily(glyphrun2.rawFont().familyName());
+                         glyphrun2.setRawFont(QRawFont::fromFont(f2));
+                         }
+--- a/mscore/preferences.cpp
++++ b/mscore/preferences.cpp
+@@ -102,7 +102,7 @@ void Preferences::init(bool storeInMemor
+             {PREF_EXPORT_MP3_BITRATE,                              new IntPreference(128, false)},
+             {PREF_EXPORT_MUSICXML_EXPORTBREAKS,                    new EnumPreference(QVariant::fromValue(MusicxmlExportBreaks::ALL), false)},
+             {PREF_EXPORT_MUSICXML_EXPORTLAYOUT,                    new BoolPreference(true, false)},
+-            {PREF_EXPORT_PDF_DPI,                                  new IntPreference(300, false)},
++            {PREF_EXPORT_PDF_DPI,                                  new IntPreference(DPI, false)},
+             {PREF_EXPORT_PNG_RESOLUTION,                           new DoublePreference(300.0, false)},
+             {PREF_EXPORT_PNG_USETRANSPARENCY,                      new BoolPreference(true, false)},
+             {PREF_IMPORT_GUITARPRO_CHARSET,                        new StringPreference("UTF-8", false)},
diff --git a/debian/patches/upstream/qt514-1.diff b/debian/patches/upstream/qt514-1.diff
new file mode 100644 (file)
index 0000000..116d194
--- /dev/null
@@ -0,0 +1,178 @@
+Origin: vendor, commit:09d138946aad53962ce23298093747f0ce52304f
+Author: Jérôme Duval <jerome.duval@gmail.com>
+Description: Specializes template routines.
+ Qt 5.14 introduces serialisation/deserialisation for enum classes,
+ this results in ambiguous templates between qdatastream.h and preferences.h.
+ we specialize everything to workaround this.
+
+--- a/mscore/capella.cpp
++++ b/mscore/capella.cpp
+@@ -2708,7 +2708,7 @@ Score::FileError importCapella(MasterSco
+                   QMessageBox::warning(0,
+                      QWidget::tr("Import Capella"),
+                      QWidget::tr("Load failed: %1").arg(cf.error(errNo)),
+-                     QString::null, QWidget::tr("Quit"), QString::null, 0, 1);
++                     QString(), QWidget::tr("Quit"), QString(), 0, 1);
+                   }
+             fp.close();
+             // avoid another error message box
+--- a/mscore/importmidi/importmidi.cpp
++++ b/mscore/importmidi/importmidi.cpp
+@@ -1200,7 +1200,7 @@ Score::FileError importMidi(MasterScore
+                         QMessageBox::warning(0,
+                            QWidget::tr("Load MIDI"),
+                            QWidget::tr("Load failed: %1").arg(errorText),
+-                           QString::null, QWidget::tr("Quit"), QString::null, 0, 1);
++                           QString(), QWidget::tr("Quit"), QString(), 0, 1);
+                         }
+                   fp.close();
+                   qDebug("importMidi: bad file format");
+--- a/mscore/instrdialog.cpp
++++ b/mscore/instrdialog.cpp
+@@ -138,7 +138,7 @@ void InstrumentsDialog::on_loadButton_cl
+             QMessageBox::warning(0,
+                QWidget::tr("Load Style Failed"),
+                QString(strerror(errno)),
+-               QString::null, QWidget::tr("Quit"), QString::null, 0, 1);
++               QString(), QWidget::tr("Quit"), QString(), 0, 1);
+             return;
+             }
+       instrumentsWidget->buildTemplateList();
+--- a/mscore/musescore.cpp
++++ b/mscore/musescore.cpp
+@@ -4022,7 +4022,7 @@ bool MuseScore::readLanguages(const QStr
+                 QMessageBox::warning(0,
+                    QWidget::tr("Load Languages Failed:"),
+                    error,
+-                   QString::null, QWidget::tr("Quit"), QString::null, 0, 1);
++                   QString(), QWidget::tr("Quit"), QString(), 0, 1);
+                 return false;
+                 }
+@@ -6813,7 +6813,7 @@ bool MuseScore::saveMp3(Score* score, co
+                   QMessageBox::warning(0,
+                                        tr("Encoding Error"),
+                                        tr("Unable to open target file for writing"),
+-                                       QString::null, QString::null);
++                                       QString(), QString());
+                   }
+             return false;
+             }
+@@ -6841,7 +6841,7 @@ bool MuseScore::saveMp3(Score* score, QI
+                   QMessageBox::warning(0,
+                                tr("Error Opening LAME library"),
+                                tr("Could not open MP3 encoding library!"),
+-                               QString::null, QString::null);
++                               QString(), QString());
+             qDebug("Could not open MP3 encoding library!");
+             return false;
+             }
+@@ -6853,7 +6853,7 @@ bool MuseScore::saveMp3(Score* score, QI
+                   QMessageBox::warning(0,
+                                tr("Error Opening LAME library"),
+                                tr("Not a valid or supported MP3 encoding library!"),
+-                               QString::null, QString::null);
++                               QString(), QString());
+             qDebug("Not a valid or supported MP3 encoding library!");
+             return false;
+             }
+@@ -6878,7 +6878,7 @@ bool MuseScore::saveMp3(Score* score, QI
+             if (!MScore::noGui) {
+                   QMessageBox::warning(0, tr("Encoding Error"),
+                      tr("Unable to initialize MP3 stream"),
+-                     QString::null, QString::null);
++                     QString(), QString());
+                   }
+             qDebug("Unable to initialize MP3 stream");
+             MScore::sampleRate = oldSampleRate;
+@@ -7045,7 +7045,7 @@ bool MuseScore::saveMp3(Score* score, QI
+                                     QMessageBox::warning(0,
+                                        tr("Encoding Error"),
+                                        tr("Error %1 returned from MP3 encoder").arg(bytes),
+-                                       QString::null, QString::null);
++                                       QString(), QString());
+                               break;
+                               }
+                         else
+--- a/mscore/musescore.h
++++ b/mscore/musescore.h
+@@ -135,7 +135,7 @@ struct LanguageItem {
+       LanguageItem(const QString k, const QString n) {
+             key = k;
+             name = n;
+-            handbook = QString::null;
++            handbook = QString();
+             }
+       LanguageItem(const QString k, const QString n, const QString h) {
+             key = k;
+--- a/mscore/network/loginmanager.cpp
++++ b/mscore/network/loginmanager.cpp
+@@ -793,7 +793,7 @@ void LoginManager::mediaUploadFinished()
+             QMessageBox::warning(0,
+                      tr("Upload Error"),
+                      tr("Sorry, MuseScore couldn't upload the audio file. Error %1").arg(e),
+-                     QString::null, QString::null);
++                     QString(), QString());
+             }
+       }
+--- a/mscore/preferences.h
++++ b/mscore/preferences.h
+@@ -372,21 +372,52 @@ extern Preferences preferences;
+ // Stream operators for enum classes
+ // enum classes don't play well with QSettings without custom serialization
+-template<typename T, typename std::enable_if<std::is_enum<T>::value>::type* = nullptr>
+-inline QDataStream &operator<<(QDataStream &out, const T &val)
++inline QDataStream&
++operator<<(QDataStream &out, const Ms::MuseScoreStyleType &val)
+ {
+     return out << static_cast<int>(val);
+ }
+-template<typename T, typename std::enable_if<std::is_enum<T>::value>::type* = nullptr>
+-inline QDataStream &operator>>(QDataStream &in, T &val)
++inline QDataStream&
++operator>>(QDataStream &in, Ms::MuseScoreStyleType &val)
+ {
+     int tmp;
+     in >> tmp;
+-    val = static_cast<T>(tmp);
++    val = static_cast<Ms::MuseScoreStyleType>(tmp);
+     return in;
+ }
++inline QDataStream&
++operator<<(QDataStream &out, const Ms::SessionStart &val)
++{
++    return out << static_cast<int>(val);
++}
++
++inline QDataStream&
++operator>>(QDataStream &in, Ms::SessionStart &val)
++{
++    int tmp;
++    in >> tmp;
++    val = static_cast<Ms::SessionStart>(tmp);
++    return in;
++}
++
++inline QDataStream&
++operator<<(QDataStream &out, const Ms::MusicxmlExportBreaks &val)
++{
++    return out << static_cast<int>(val);
++}
++
++inline QDataStream&
++operator>>(QDataStream &in, Ms::MusicxmlExportBreaks &val)
++{
++    int tmp;
++    in >> tmp;
++    val = static_cast<Ms::MusicxmlExportBreaks>(tmp);
++    return in;
++}
++
++
+ class PreferenceVisitor {
+    public:
+       virtual void visit(QString key, IntPreference*) = 0;
diff --git a/debian/patches/upstream/workspace-warning.diff b/debian/patches/upstream/workspace-warning.diff
new file mode 100644 (file)
index 0000000..0862684
--- /dev/null
@@ -0,0 +1,53 @@
+Origin: vendor, commit:2c69a6dc1f302f4ca12903fc1788e7c96cbdaf13
+From: Matt McClinch <mattmcclinch@gmail.com>
+Description: Fix #305209: ticks_f warnings when loading a custom workspace
+ Resolves: https://musescore.org/en/node/305209
+ .
+ When reading in XML data, the _pasteMode flag of the XmlReader should
+ match the _clipboardmode flag of the XmlWriter that wrote the data. In
+ each of the four places that an XmlWriter is constructed in
+ mscore/workspace.cpp, the _clipboardmode flag of the XmlWriter is set
+ to true. For this reason, in each of the four places that an XmlReader
+ is constructed in mscore/workspace.cpp, the _pasteMode flag of the
+ XmlReader should be set to true to ensure that the data is interpreted
+ correctly.
+ .
+ For example, the XML for a Spanner object will include a "ticks_f" tag
+ if and only if the _clipboardmode flag of the XmlWriter is true. When
+ this XML is read back in, the XmlReader will not expect to find a
+ "ticks_f" tag if its _pasteMode flag is false.
+
+--- a/mscore/workspace.cpp
++++ b/mscore/workspace.cpp
+@@ -582,6 +582,7 @@ void Workspace::read()
+       QByteArray ba = f.fileData(rootfile);
+       XmlReader e(ba);
++      e.setPasteMode(true);
+       preferences.updateLocalPreferences();
+@@ -801,6 +802,7 @@ void Workspace::readGlobalMenuBar()
+       QByteArray ba (default_menubar.readAll());
+       XmlReader e(ba);
++      e.setPasteMode(true);
+       while (e.readNextStartElement()) {
+             if (e.name() == "museScore") {
+@@ -853,6 +855,7 @@ void Workspace::readGlobalToolBar()
+       QByteArray ba (default_toolbar.readAll());
+       XmlReader e(ba);
++      e.setPasteMode(true);
+       while (e.readNextStartElement()) {
+             if (e.name() == "museScore") {
+@@ -917,6 +920,7 @@ void Workspace::readGlobalGUIState()
+       QByteArray ba (default_toolbar.readAll());
+       XmlReader e(ba);
++      e.setPasteMode(true);
+       while (e.readNextStartElement()) {
+             if (e.name() == "museScore") {