Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Musical symbols scale' option #20934

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/engraving/dom/mscore.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ static constexpr double SPATIUM20 = 5.0 * (DPI / 72.0);
static constexpr double DPMM = DPI / INCH;

// NOTE: the Smufl default is actually 20pt. We use 10 for historical reasons
// and back-compatibility, but this will be multiplied x2 during dynamic layout.
static constexpr double DYNAMICS_DEFAULT_FONT_SIZE = 10.0;
// and back-compatibility, but this will be multiplied x2 during layout.
static constexpr double MUSICAL_SYMBOLS_DEFAULT_FONT_SIZE = 10.0;

static constexpr int MAX_STAVES = 4;

Expand Down
1 change: 1 addition & 0 deletions src/engraving/dom/ottava.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ OttavaSegment::OttavaSegment(Ottava* sp, System* parent)
: TextLineBaseSegment(ElementType::OTTAVA_SEGMENT, sp, parent, ElementFlag::MOVABLE | ElementFlag::ON_STAFF)
{
m_text->setTextStyleType(TextStyleType::OTTAVA);
m_endText->setTextStyleType(TextStyleType::OTTAVA);
}

//---------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions src/engraving/dom/pedal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "measure.h"
#include "score.h"
#include "system.h"
#include "text.h"

#include "log.h"

Expand Down Expand Up @@ -65,6 +66,8 @@ const String Pedal::STAR_SYMBOL = u"<sym>keyboardPedalUp</sym>";
PedalSegment::PedalSegment(Pedal* sp, System* parent)
: TextLineBaseSegment(ElementType::PEDAL_SEGMENT, sp, parent, ElementFlag::MOVABLE | ElementFlag::ON_STAFF)
{
m_text->setTextStyleType(TextStyleType::PEDAL);
m_endText->setTextStyleType(TextStyleType::PEDAL);
}

//---------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions src/engraving/dom/property.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ static constexpr PropertyMetaData propertyList[] = {
{ Pid::FRAME_BG_COLOR, false, "frameBgColor", P_TYPE::COLOR, PropertyGroup::APPEARANCE, DUMMY_QT_TR_NOOP("propertyName", "frame background color") },
{ Pid::SIZE_SPATIUM_DEPENDENT, false, "sizeIsSpatiumDependent",P_TYPE::BOOL, PropertyGroup::APPEARANCE, DUMMY_QT_TR_NOOP("propertyName", "spatium dependent size") },
{ Pid::TEXT_SIZE_SPATIUM_DEPENDENT, false, "textSizeIsSpatiumDependent", P_TYPE::BOOL, PropertyGroup::APPEARANCE, DUMMY_QT_TR_NOOP("propertyName", "spatium dependent text size") },
{ Pid::MUSICAL_SYMBOLS_SCALE, false, "musicalSymbolsScale", P_TYPE::REAL, PropertyGroup::APPEARANCE, DUMMY_QT_TR_NOOP("propertyName", "musical symbols scale") },
{ Pid::ALIGN, false, "align", P_TYPE::ALIGN, PropertyGroup::POSITION, DUMMY_QT_TR_NOOP("propertyName", "align") },
{ Pid::TEXT_SCRIPT_ALIGN, false, "align", P_TYPE::INT, PropertyGroup::POSITION, DUMMY_QT_TR_NOOP("propertyName", "text script align") },
{ Pid::SYSTEM_FLAG, false, "systemFlag", P_TYPE::BOOL, PropertyGroup::APPEARANCE, DUMMY_QT_TR_NOOP("propertyName", "system flag") },
Expand Down
1 change: 1 addition & 0 deletions src/engraving/dom/property.h
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ enum class Pid {
FRAME_BG_COLOR,
SIZE_SPATIUM_DEPENDENT,
TEXT_SIZE_SPATIUM_DEPENDENT, // for text component of textLine items
MUSICAL_SYMBOLS_SCALE,
ALIGN,
TEXT_SCRIPT_ALIGN,
SYSTEM_FLAG,
Expand Down
25 changes: 19 additions & 6 deletions src/engraving/dom/textbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -872,15 +872,28 @@ mu::draw::Font TextFragment::font(const TextBase* t) const
draw::Font::Type fontType = draw::Font::Type::Unknown;
if (format.fontFamily() == "ScoreText") {
if (t->isDynamic() || t->textStyleType() == TextStyleType::OTTAVA || t->textStyleType() == TextStyleType::HARP_PEDAL_DIAGRAM
|| t->isStringTunings()) {
|| t->textStyleType() == TextStyleType::TUPLET || t->textStyleType() == TextStyleType::PEDAL || t->isStringTunings()) {
std::string fontName = engravingFonts()->fontByName(t->style().styleSt(Sid::MusicalSymbolFont).toStdString())->family();
family = String::fromStdString(fontName);
fontType = draw::Font::Type::MusicSymbol;
if (t->isDynamic()) {
m = DYNAMICS_DEFAULT_FONT_SIZE * t->getProperty(Pid::DYNAMICS_SIZE).toDouble() * spatiumScaling;
if (t->style().styleB(Sid::dynamicsOverrideFont)) {
std::string fontName2 = engravingFonts()->fontByName(t->style().styleSt(Sid::dynamicsFont).toStdString())->family();
family = String::fromStdString(fontName2);
if (!t->isStringTunings()) {
m = MUSICAL_SYMBOLS_DEFAULT_FONT_SIZE;
if (t->isDynamic()) {
m *= t->getProperty(Pid::DYNAMICS_SIZE).toDouble() * spatiumScaling;
if (t->style().styleB(Sid::dynamicsOverrideFont)) {
std::string fontName2 = engravingFonts()->fontByName(t->style().styleSt(Sid::dynamicsFont).toStdString())->family();
family = String::fromStdString(fontName2);
}
} else {
for (const auto& a : *textStyle(t->textStyleType())) {
if (a.type == TextStylePropertyType::MusicalSymbolsScale) {
m *= t->style().styleD(a.sid);
if (t->sizeIsSpatiumDependent()) {
m *= spatiumScaling;
}
break;
}
}
}
}
// We use a default font size of 10pt for historical reasons,
Expand Down
21 changes: 16 additions & 5 deletions src/engraving/rendering/dev/tupletlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ void TupletLayout::layout(Tuplet* item, LayoutContext& ctx)
//
// create tuplet number if necessary
//
const MStyle& style = ctx.conf().style();
double _spatium = item->spatium();
if (item->numberType() != TupletNumberType::NO_TEXT) {
if (item->number() == nullptr) {
Expand All @@ -71,10 +72,21 @@ void TupletLayout::layout(Tuplet* item, LayoutContext& ctx)
item->number()->setPropertyFlags(Pid::FONT_SIZE, item->propertyFlags(Pid::FONT_SIZE));
item->number()->setPropertyFlags(Pid::FONT_STYLE, item->propertyFlags(Pid::FONT_STYLE));
item->number()->setPropertyFlags(Pid::ALIGN, item->propertyFlags(Pid::ALIGN));
if (item->numberType() == TupletNumberType::SHOW_NUMBER) {
item->number()->setXmlText(String(u"%1").arg(item->ratio().numerator()));

String numberString = (item->numberType() == TupletNumberType::SHOW_NUMBER)
? String(u"%1").arg(item->ratio().numerator())
: String(u"%1:%2").arg(item->ratio().numerator(), item->ratio().denominator());
if (style.styleB(Sid::tupletUseSymbols)) {
String smuflNum = String(u"");
for (size_t i = 0; i < numberString.size(); ++i) {
smuflNum.append(u"<sym>tuplet");
smuflNum.append(numberString.at(i).unicode());
smuflNum.append(u"</sym>");
}
smuflNum.replace(String(u":"), String(u"Colon"));
item->number()->setXmlText(smuflNum);
} else {
item->number()->setXmlText(String(u"%1:%2").arg(item->ratio().numerator(), item->ratio().denominator()));
item->number()->setXmlText(numberString);
}

item->setIsSmall(true);
Expand All @@ -84,7 +96,7 @@ void TupletLayout::layout(Tuplet* item, LayoutContext& ctx)
break;
}
}
item->number()->mutldata()->setMag(item->isSmall() ? ctx.conf().styleD(Sid::smallNoteMag) : 1.0);
item->number()->mutldata()->setMag(item->isSmall() ? style.styleD(Sid::smallNoteMag) : 1.0);
} else {
if (item->number()) {
if (item->number()->selected()) {
Expand Down Expand Up @@ -150,7 +162,6 @@ void TupletLayout::layout(Tuplet* item, LayoutContext& ctx)
//
// calculate bracket start and end point p1 p2
//
const MStyle& style = ctx.conf().style();
double maxSlope = style.styleD(Sid::tupletMaxSlope);
bool outOfStaff = style.styleB(Sid::tupletOufOfStaff);
double vHeadDistance = style.styleMM(Sid::tupletVHeadDistance) * item->mag();
Expand Down
12 changes: 10 additions & 2 deletions src/engraving/style/styledef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,10 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::pedalDashGapLen, "pedalDashGapLen", 4.0 },
{ Sid::pedalHookHeight, "pedalHookHeight", Spatium(-1.2) },
{ Sid::pedalFontFace, "pedalFontFace", "Edwin" },
{ Sid::pedalFontSize, "pedalFontSize", 12.0 },
{ Sid::pedalFontSize, "pedalFontSize", 10.0 },
{ Sid::pedalLineSpacing, "pedalLineSpacing", 1.0 },
{ Sid::pedalFontSpatiumDependent, "pedalFontSpatiumDependent", true },
{ Sid::pedalMusicalSymbolsScale, "pedalMusicalSymbolsScale", 1.0 }, // percentage of the standard size
{ Sid::pedalFontStyle, "pedalFontStyle", int(FontStyle::Normal) },
{ Sid::pedalColor, "pedalColor", Color::BLACK },
{ Sid::pedalTextAlign, "pedalTextAlign", Align(AlignH::LEFT, AlignV::BASELINE) },
Expand All @@ -285,7 +286,8 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::pedalFrameBgColor, "pedalFrameBgColor", Color::transparent },
{ Sid::pedalText, "pedalText", String(u"<sym>keyboardPedalPed</sym>") },
{ Sid::pedalHookText, "pedalHookText", String() },
{ Sid::pedalContinueText, "pedalContinueText", String(u"(<sym>keyboardPedalPed</sym>)") },
{ Sid::pedalContinueText, "pedalContinueText",
String(u"<sym>keyboardPedalParensLeft</sym><sym>keyboardPedalPed</sym><sym>keyboardPedalParensRight</sym>") },
{ Sid::pedalContinueHookText, "pedalContinueHookText", String() },
{ Sid::pedalEndText, "pedalEndText", String() },
{ Sid::pedalRosetteEndText, "pedalRosetteEndText", String(u"<sym>keyboardPedalUp</sym>") },
Expand Down Expand Up @@ -583,6 +585,7 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::ottavaFontSize, "ottavaFontSize", 10.0 },
{ Sid::ottavaLineSpacing, "ottavaLineSpacing", 1.0 },
{ Sid::ottavaFontSpatiumDependent, "ottavaFontSpatiumDependent", true },
{ Sid::ottavaMusicalSymbolsScale, "ottavaMusicalSymbolsScale", 1.0 }, // percentage of the standard size
{ Sid::ottavaFontStyle, "ottavaFontStyle", int(FontStyle::Normal) },
{ Sid::ottavaColor, "ottavaColor", PropertyValue::fromValue(Color::BLACK) },
{ Sid::ottavaTextAlignAbove, "ottavaTextAlignAbove", Align(AlignH::LEFT, AlignV::TOP) },
Expand Down Expand Up @@ -625,9 +628,11 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::tupletFontSize, "tupletFontSize", 9.0 },
{ Sid::tupletLineSpacing, "tupletLineSpacing", 1.0 },
{ Sid::tupletFontSpatiumDependent, "tupletFontSpatiumDependent", true },
{ Sid::tupletMusicalSymbolsScale, "tupletMusicalSymbolsScale", 1.0 }, // percentage of the standard size
{ Sid::tupletFontStyle, "tupletFontStyle", int(FontStyle::Italic) },
{ Sid::tupletColor, "tupletColor", PropertyValue::fromValue(Color::BLACK) },
{ Sid::tupletAlign, "tupletAlign", Align(AlignH::HCENTER, AlignV::VCENTER) },
{ Sid::tupletUseSymbols, "tupletUseSymbols", false },
{ Sid::tupletBracketHookHeight, "tupletBracketHookHeight", Spatium(0.75) },
{ Sid::tupletOffset, "tupletOffset", PointF() },
{ Sid::tupletFrameType, "tupletFrameType", int(FrameType::NO_FRAME) },
Expand Down Expand Up @@ -831,6 +836,7 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::harpPedalDiagramFontSize, "harpPedalDiagramFontSize", 10.0 },
{ Sid::harpPedalDiagramLineSpacing, "harpPedalDiagramLineSpacing", 1.0 },
{ Sid::harpPedalDiagramFontSpatiumDependent, "harpPedalDiagramFontSpatiumDependent", true },
{ Sid::harpPedalDiagramMusicalSymbolsScale, "harpPedalDiagramMusicalSymbolsScale", 1.0 }, // percentage of the standard size
{ Sid::harpPedalDiagramFontStyle, "harpPedalDiagramFontStyle", int(FontStyle::Normal) },
{ Sid::harpPedalDiagramColor, "harpPedalDiagramColor", PropertyValue::fromValue(Color::BLACK) },
{ Sid::harpPedalDiagramAlign, "harpPedalDiagramAlign", Align(AlignH::HCENTER, AlignV::VCENTER) },
Expand Down Expand Up @@ -1609,6 +1615,8 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue

{ Sid::chordlineThickness, "chordlineThickness", Spatium(0.16) },

{ Sid::dummyMusicalSymbolsScale, "dummyMusicalSymbolsScale", 1.0 },

{ Sid::autoplaceEnabled, "autoplaceEnabled", true },
{ Sid::defaultsVersion, "defaultsVersion", Constants::MSC_VERSION }
} };
7 changes: 7 additions & 0 deletions src/engraving/style/styledef.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ enum class Sid {
pedalFontSize,
pedalLineSpacing,
pedalFontSpatiumDependent,
pedalMusicalSymbolsScale,
pedalFontStyle,
pedalColor,
pedalTextAlign,
Expand Down Expand Up @@ -593,6 +594,7 @@ enum class Sid {
ottavaFontSize,
ottavaLineSpacing,
ottavaFontSpatiumDependent,
ottavaMusicalSymbolsScale,
ottavaFontStyle,
ottavaColor,
ottavaTextAlignAbove,
Expand Down Expand Up @@ -636,9 +638,11 @@ enum class Sid {
tupletFontSize,
tupletLineSpacing,
tupletFontSpatiumDependent,
tupletMusicalSymbolsScale,
tupletFontStyle,
tupletColor,
tupletAlign,
tupletUseSymbols,
tupletBracketHookHeight,
tupletOffset,
tupletFrameType,
Expand Down Expand Up @@ -843,6 +847,7 @@ enum class Sid {
harpPedalDiagramFontSize,
harpPedalDiagramLineSpacing,
harpPedalDiagramFontSpatiumDependent,
harpPedalDiagramMusicalSymbolsScale,
harpPedalDiagramFontStyle,
harpPedalDiagramColor,
harpPedalDiagramAlign,
Expand Down Expand Up @@ -1617,6 +1622,8 @@ enum class Sid {

chordlineThickness,

dummyMusicalSymbolsScale,

autoplaceEnabled,
defaultsVersion,

Expand Down
Loading
Loading