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
add comments to explain magic numbers
  • Loading branch information
Nick-Mazuk authored and vpereverzev committed Oct 11, 2021
1 parent 203c576 commit 3bda156
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/engraving/libmscore/textbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -962,10 +962,12 @@ mu::draw::Font TextFragment::font(const TextBase* t) const
if (format.fontFamily() == "ScoreText") {
if (t->parent() && t->isDynamic()) {
family = t->score()->scoreFont()->fontByName(t->score()->styleSt(Sid::MusicalSymbolFont))->family();
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
4 changes: 1 addition & 3 deletions src/engraving/style/styledef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,8 +823,7 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::partInstrumentFrameBgColor, "partInstrumentFrameBgColor", QVariant::fromValue(draw::Color::transparent) },

{ 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 @@ -855,7 +854,6 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue

{ 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 src/engraving/style/styledef.h
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,6 @@ enum class Sid {

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

tempoFontFace,
tempoFontSize,
tempoSymbolFontSize,
tempoLineSpacing,
tempoFontSpatiumDependent,
tempoFontStyle,
Expand Down

0 comments on commit 3bda156

Please sign in to comment.