From fc321fac567c735da149cb18075364646e09100a Mon Sep 17 00:00:00 2001 From: James Mizen Date: Tue, 20 Aug 2024 13:13:45 +0200 Subject: [PATCH] Support more symbol fonts used in xml files Backport of #24041 --- importexport/musicxml/importmxmlpass2.cpp | 10 ++++++---- importexport/musicxml/importmxmlpass2.h | 3 ++- importexport/musicxml/musicxmlsupport.h | 2 ++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/importexport/musicxml/importmxmlpass2.cpp b/importexport/musicxml/importmxmlpass2.cpp index f36bff921aa1c..a21f7e1eb02fe 100644 --- a/importexport/musicxml/importmxmlpass2.cpp +++ b/importexport/musicxml/importmxmlpass2.cpp @@ -3276,7 +3276,6 @@ void MusicXMLParserDirection::direction(const QString& partId, else skipLogCurrElem(); } - handleTempo(); handleRepeats(measure, track, tick + _offset); handleNmiCmi(measure, track, tick + _offset, delayedDirections); handleChordSym(track, tick + _offset, harmonyMap); @@ -3612,14 +3611,17 @@ void MusicXMLParserDirection::directionType(QList& starts, if (_e.name() == "metronome") _metroText = metronome(_tpoMetro); else if (_e.name() == "words") { - _enclosure = _e.attributes().value("enclosure").toString(); + _enclosure = _e.attributes().value("enclosure").toString(); + _fontFamily = _e.attributes().value("font-family").toString(); QString nextPart = nextPartOfFormattedString(_e); + textToDynamic(nextPart); textToCrescLine(nextPart); + handleTempo(nextPart); _wordsText += nextPart; } else if (_e.name() == "rehearsal") { - _enclosure = _e.attributes().value("enclosure").toString(); + _enclosure = _e.attributes().value("enclosure").toString(); if (_enclosure.isEmpty()) _enclosure = "square"; // note different default _rehearsalText += nextPartOfFormattedString(_e); @@ -4389,7 +4391,7 @@ void MusicXMLParserDirection::handleChordSym(const int track, const Fraction tic _wordsText.clear(); } -void MusicXMLParserDirection::handleTempo() +void MusicXMLParserDirection::handleTempo(QString& wordsString) { // Pick up any tempo markings which may have been exported from Sibelius as // eg. andante (q = c. 90) diff --git a/importexport/musicxml/importmxmlpass2.h b/importexport/musicxml/importmxmlpass2.h index b5031d28ae3ea..0b7f2c369920c 100644 --- a/importexport/musicxml/importmxmlpass2.h +++ b/importexport/musicxml/importmxmlpass2.h @@ -406,6 +406,7 @@ class MusicXMLParserDirection { Hairpin* _inferredHairpinStart = nullptr; QStringList _dynamicsList; QString _enclosure; + QString _fontFamily; QString _wordsText; QString _metroText; QString _rehearsalText; @@ -444,7 +445,7 @@ class MusicXMLParserDirection { void handleRepeats(Measure* measure, const int track, const Fraction tick); QString matchRepeat() const; void handleNmiCmi(Measure* measure, const int track, const Fraction tick, DelayedDirectionsList& delayedDirections); - void handleTempo(); + void handleTempo(QString& wordsString); void handleChordSym(const int track, const Fraction tick, HarmonyMap& harmonyMap); bool isLikelyFingering(const QString& fingeringStr) const; bool isLikelyCredit(const Fraction& tick) const; diff --git a/importexport/musicxml/musicxmlsupport.h b/importexport/musicxml/musicxmlsupport.h index 7699ab7dd34fa..cbcccc76a24c1 100644 --- a/importexport/musicxml/musicxmlsupport.h +++ b/importexport/musicxml/musicxmlsupport.h @@ -20,6 +20,7 @@ #ifndef __MUSICXMLSUPPORT_H__ #define __MUSICXMLSUPPORT_H__ +#include "libmscore/durationtype.h" #include "libmscore/fraction.h" #include "libmscore/fret.h" #include "libmscore/note.h" @@ -184,6 +185,7 @@ struct MusicXMLInstrument { typedef QMap MusicXMLInstruments; typedef QMapIterator MusicXMLInstrumentsIterator; +typedef QMap > MetronomeTextMap; //---------------------------------------------------------