Skip to content

Commit

Permalink
Let dynamic/tempo symbols auto-resize to surrounding text
Browse files Browse the repository at this point in the history
Backport of musescore#9395, plus fixing an mtest
  • Loading branch information
Nick-Mazuk authored and Jojo-Schmitz committed Oct 8, 2021
1 parent 009ddc7 commit 9b1044d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
4 changes: 1 addition & 3 deletions libmscore/style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -822,8 +822,7 @@ static const StyleType styleTypes[] {
{ Sid::partInstrumentFrameBgColor, "partInstrumentFrameBgColor", QColor(255, 255, 255, 0) },

{ Sid::dynamicsFontFace, "dynamicsFontFace", "Edwin" },
{ Sid::dynamicsFontSize, "dynamicsFontSize", 11.0 },
{ Sid::dynamicsSymbolFontSize, "dynamicsSymbolFontSize", 20.0 },
{ Sid::dynamicsFontSize, "dynamicsFontSize", 10.0 },
{ Sid::dynamicsLineSpacing, "dynamicsLineSpacing", 1.0 },
{ Sid::dynamicsFontSpatiumDependent, "dynamicsFontSpatiumDependent", true },
{ Sid::dynamicsFontStyle, "dynamicsFontStyle", int(FontStyle::Italic) },
Expand Down Expand Up @@ -854,7 +853,6 @@ static const StyleType styleTypes[] {

{ Sid::tempoFontFace, "tempoFontFace", "Edwin" },
{ Sid::tempoFontSize, "tempoFontSize", 12.0 },
{ Sid::tempoSymbolFontSize, "tempoSymbolFontSize", 20.0 },
{ Sid::tempoLineSpacing, "tempoLineSpacing", 1.0 },
{ Sid::tempoFontSpatiumDependent, "tempoFontSpatiumDependent", true },
{ Sid::tempoFontStyle, "tempoFontStyle", int(FontStyle::Bold) },
Expand Down
2 changes: 0 additions & 2 deletions libmscore/style.h
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,6 @@ enum class Sid {

dynamicsFontFace,
dynamicsFontSize,
dynamicsSymbolFontSize,
dynamicsLineSpacing,
dynamicsFontSpatiumDependent,
dynamicsFontStyle,
Expand Down Expand Up @@ -838,7 +837,6 @@ enum class Sid {

tempoFontFace,
tempoFontSize,
tempoSymbolFontSize,
tempoLineSpacing,
tempoFontSpatiumDependent,
tempoFontStyle,
Expand Down
8 changes: 6 additions & 2 deletions libmscore/textbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -855,18 +855,22 @@ QFont TextFragment::font(const TextBase* t) const
if (t->parent() && t->isDynamic()) {
#if 0 // no fontByName() in 3.x?
family = t->score()->scoreFont()->fontByName(t->score()->styleSt(Sid::MusicalSymbolFont))->family();
//family = t->score()->scoreFont()->fontByName(t->score()->styleSt(Sid::MusicalTestFont)replace(" Text", ""))->family();
#else
family = t->score()->styleSt(Sid::MusicalSymbolFont);
//family = t->score()->styleSt(Sid::MusicalTextFont).replace(" Text", "");
if (family == "Emmentaler")
family = "MScore";
else if (family == "Gonville")
family = "Gootville";
#endif
m = t->score()->styleV(Sid::dynamicsSymbolFontSize).toReal() * t->mag();
// to keep desired size ratio (based on 20pt symbol size to 10pt text size)
m *= 2;
}
else if (t->parent() && t->isTempoText()) {
family = t->score()->styleSt(Sid::MusicalTextFont);
m = t->score()->styleV(Sid::tempoSymbolFontSize).toReal();
// to keep desired size ratio (based on 20pt symbol size to 12pt text size)
m *= 5.0 / 3.0;
}
else {
family = t->score()->styleSt(Sid::MusicalTextFont);
Expand Down
1 change: 0 additions & 1 deletion mtest/musicxml/io/testMeasureStyleSlash_ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
<rhGuitarFingeringFontSize>10</rhGuitarFingeringFontSize>
<stringNumberFontSize>10</stringNumberFontSize>
<partInstrumentFontSize>10</partInstrumentFontSize>
<dynamicsFontSize>10</dynamicsFontSize>
<tempoFontSize>10</tempoFontSize>
<metronomeFontSize>10</metronomeFontSize>
<measureNumberFontSize>10</measureNumberFontSize>
Expand Down

0 comments on commit 9b1044d

Please sign in to comment.