Skip to content

Commit

Permalink
Fix GH#18158: Do not export invisible text lines
Browse files Browse the repository at this point in the history
Backport of musescore#20225
  • Loading branch information
rettinghaus authored and Jojo-Schmitz committed Dec 4, 2023
1 parent a6cba54 commit b5a41a2
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions importexport/musicxml/exportxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4822,6 +4822,9 @@ int ExportMusicXml::findBracket(const TextLineBase* tl) const

void ExportMusicXml::textLine(TextLineBase const* const tl, int staff, const Fraction& tick)
{
if (tl->lineVisible() && (tl->beginText().isEmpty() || tl->endText().isEmpty()))
return;

int n;
// special case: a dashed line w/o hooks is written as dashes
const auto isDashes = tl->lineStyle() == Qt::DashLine && (tl->beginHookType() == HookType::NONE) && (tl->endHookType() == HookType::NONE);
Expand Down Expand Up @@ -4924,12 +4927,14 @@ void ExportMusicXml::textLine(TextLineBase const* const tl, int staff, const Fra
_xml.etag();
}

_xml.stag("direction-type");
if (isDashes)
_xml.tagE(QString("dashes type=\"%1\" number=\"%2\"").arg(type, QString::number(n + 1)));
else
_xml.tagE(QString("bracket type=\"%1\" number=\"%2\" line-end=\"%3\"%4").arg(type, QString::number(n + 1), lineEnd, rest));
_xml.etag();
if (tl->lineVisible()) {
_xml.stag("direction-type");
if (isDashes)
_xml.tagE(QString("dashes type=\"%1\" number=\"%2\"").arg(type, QString::number(n + 1)));
else
_xml.tagE(QString("bracket type=\"%1\" number=\"%2\" line-end=\"%3\"%4").arg(type, QString::number(n + 1), lineEnd, rest));
_xml.etag();
}

if (!tl->endText().isEmpty() && tl->tick() != tick) {
_xml.stag("direction-type");
Expand Down

0 comments on commit b5a41a2

Please sign in to comment.