Skip to content

Commit

Permalink
Adjust line spacing of reformatted header VBox
Browse files Browse the repository at this point in the history
This commit changes the vertical padding to 1.2 * the line height when
reformatting a header box with inferred credits or subtitles.

Duplicate of musescore#8678, part 7
  • Loading branch information
iveshenry18 authored and Jojo-Schmitz committed Mar 5, 2023
1 parent b70eacb commit 9530397
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions importexport/musicxml/importmxmlpass2.cpp
Expand Up @@ -1480,7 +1480,7 @@ static void reformatHeaderVBox(MeasureBase* mb)
Score* score = mb->score();
qreal totalHeight = 0;
qreal offsetHeight = 0;
qreal verticalPadding = score->styleS(Sid::minVerticalDistance).val() * score->spatium();
qreal lineSpacingMultiplier = 1.2;

for (auto e : headerVBox->el()) {
if (!e->isText())
Expand All @@ -1490,11 +1490,11 @@ static void reformatHeaderVBox(MeasureBase* mb)

totalHeight += t->height();
if (Align(t->align() & Align::VMASK) == Align::TOP) {
totalHeight += verticalPadding;
totalHeight += t->lineHeight() * lineSpacingMultiplier;
t->setOffset(t->offset().x(), offsetHeight);
t->setPropertyFlags(Pid::OFFSET, PropertyFlags::UNSTYLED);
offsetHeight += t->height();
offsetHeight += verticalPadding;
offsetHeight += t->lineHeight() * lineSpacingMultiplier;
}
}

Expand Down
4 changes: 2 additions & 2 deletions mtest/musicxml/io/testInferredCredits1_ref.mscx
Expand Up @@ -118,7 +118,7 @@ the video game: a tone poem</metaTag>
</Part>
<Staff id="1">
<VBox>
<height>13.821</height>
<height>16.256</height>
<Text>
<style>Title</style>
<text><font size="22"/>Inferred Credits 1</text>
Expand All @@ -129,7 +129,7 @@ the video game: a tone poem</metaTag>
</Text>
<Text>
<style>Subtitle</style>
<offset x="0" y="6.73111"/>
<offset x="0" y="9.32744"/>
<text>from MUSESCORE: the musical: the graphic novel:
the video game: a tone poem</text>
</Text>
Expand Down
6 changes: 3 additions & 3 deletions mtest/musicxml/io/testInferredCredits2_ref.mscx
Expand Up @@ -119,14 +119,14 @@ from MUSESCORE: the musical: a tone poem
</Part>
<Staff id="1">
<VBox>
<height>16.4981</height>
<height>19.8846</height>
<Text>
<style>Title</style>
<text>Inferred Credits 2</text>
</Text>
<Text>
<style>Subtitle</style>
<offset x="0" y="6.73111"/>
<offset x="0" y="9.32744"/>
<text>from MUSESCORE: the musical: a tone poem</text>
</Text>
<Text>
Expand All @@ -145,7 +145,7 @@ from MUSESCORE: the musical: a tone poem
</Text>
<Text>
<style>Subtitle</style>
<offset x="0" y="12.8978"/>
<offset x="0" y="17.1591"/>
<text>Op.1 No.43</text>
</Text>
</VBox>
Expand Down

0 comments on commit 9530397

Please sign in to comment.