Skip to content

Commit

Permalink
Refine engraving of StringTuning elements
Browse files Browse the repository at this point in the history
Swap figure-dash with n-dash character. Set default size to 9pt.
  • Loading branch information
mike-spa committed Dec 4, 2023
1 parent ce73551 commit a5a3ff9
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/engraving/dom/stringtunings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ String StringTunings::generateText() const
}
}

visibleStringList.emplace_back(String(guitarStringSymbol(i + 1) + u" \u2012 "
visibleStringList.emplace_back(String(guitarStringSymbol(i + 1) + u" \u2013 "
+ String(pitchStr[0]).toUpper() + accidental) + u" ");
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/dom/stringtunings.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class StringTunings final : public StaffTextBase
DECLARE_CLASSOF(ElementType::STRING_TUNINGS)

public:
explicit StringTunings(Segment* parent, TextStyleType textStyleType = TextStyleType::STAFF);
explicit StringTunings(Segment* parent, TextStyleType textStyleType = TextStyleType::STRING_TUNINGS);
StringTunings(const StringTunings& s);

StringTunings* clone() const override;
Expand Down
2 changes: 2 additions & 0 deletions src/engraving/style/styledef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,8 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::stringNumberOffset, "stringNumberOffset", PointF(0.0, 0.0) },
{ Sid::preferSameStringForTranspose, "preferSameStringForTranspose", false },

{ Sid::stringTuningsFontSize, "stringTuningsFontSize", 9.0 },

{ Sid::harpPedalDiagramFontFace, "harpPedalDiagramFontFace", "Edwin" },
{ Sid::harpPedalDiagramFontSize, "harpPedalDiagramFontSize", 10.0 },
{ Sid::harpPedalDiagramLineSpacing, "harpPedalDiagramLineSpacing", 1.0 },
Expand Down
2 changes: 2 additions & 0 deletions src/engraving/style/styledef.h
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,8 @@ enum class Sid {
stringNumberOffset,
preferSameStringForTranspose,

stringTuningsFontSize,

harpPedalDiagramFontFace,
harpPedalDiagramFontSize,
harpPedalDiagramLineSpacing,
Expand Down
19 changes: 18 additions & 1 deletion src/engraving/style/textstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,23 @@ const TextStyle stringNumberTextStyle { {
{ TextStylePropertyType::FrameFillColor, Sid::stringNumberFrameBgColor, Pid::FRAME_BG_COLOR },
} };

const TextStyle stringTuningsStyle { { // identical to staffText except for fontSize
{ TextStylePropertyType::FontFace, Sid::staffTextFontFace, Pid::FONT_FACE },
{ TextStylePropertyType::FontSize, Sid::stringTuningsFontSize, Pid::FONT_SIZE },
{ TextStylePropertyType::LineSpacing, Sid::staffTextLineSpacing, Pid::TEXT_LINE_SPACING },
{ TextStylePropertyType::SizeSpatiumDependent, Sid::staffTextFontSpatiumDependent, Pid::SIZE_SPATIUM_DEPENDENT },
{ TextStylePropertyType::FontStyle, Sid::staffTextFontStyle, Pid::FONT_STYLE },
{ TextStylePropertyType::Color, Sid::staffTextColor, Pid::COLOR },
{ TextStylePropertyType::TextAlign, Sid::staffTextAlign, Pid::ALIGN },
{ TextStylePropertyType::Offset, Sid::staffTextPosAbove, Pid::OFFSET },
{ TextStylePropertyType::FrameType, Sid::staffTextFrameType, Pid::FRAME_TYPE },
{ TextStylePropertyType::FramePadding, Sid::staffTextFramePadding, Pid::FRAME_PADDING },
{ TextStylePropertyType::FrameWidth, Sid::staffTextFrameWidth, Pid::FRAME_WIDTH },
{ TextStylePropertyType::FrameRound, Sid::staffTextFrameRound, Pid::FRAME_ROUND },
{ TextStylePropertyType::FrameBorderColor, Sid::staffTextFrameFgColor, Pid::FRAME_FG_COLOR },
{ TextStylePropertyType::FrameFillColor, Sid::staffTextFrameBgColor, Pid::FRAME_BG_COLOR },
} };

const TextStyle harpPedalDiagramTextStyle { {
{ TextStylePropertyType::FontFace, Sid::harpPedalDiagramFontFace, Pid::FONT_FACE },
{ TextStylePropertyType::FontSize, Sid::harpPedalDiagramFontSize, Pid::FONT_SIZE },
Expand Down Expand Up @@ -1093,7 +1110,7 @@ const TextStyle* textStyle(TextStyleType idx)
case TextStyleType::LH_GUITAR_FINGERING: return &lhGuitarFingeringTextStyle;
case TextStyleType::RH_GUITAR_FINGERING: return &rhGuitarFingeringTextStyle;
case TextStyleType::STRING_NUMBER: return &stringNumberTextStyle;
case TextStyleType::STRING_TUNINGS: return &stringNumberTextStyle; // todo
case TextStyleType::STRING_TUNINGS: return &stringTuningsStyle; // todo
case TextStyleType::HARP_PEDAL_DIAGRAM: return &harpPedalDiagramTextStyle;
case TextStyleType::HARP_PEDAL_TEXT_DIAGRAM: return &harpPedalTextDiagramTextStyle;

Expand Down
2 changes: 1 addition & 1 deletion src/palette/internal/palettecreator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1856,7 +1856,7 @@ PalettePtr PaletteCreator::newGuitarPalette(bool defaultPalette)

auto stringTunings = makeElement<StringTunings>(gpaletteScore);
stringTunings->setXmlText(u"<sym>guitarString6</sym> - D");
stringTunings->initTextStyleType(TextStyleType::STAFF);
stringTunings->initTextStyleType(TextStyleType::STRING_TUNINGS);
sp->appendElement(stringTunings, QT_TRANSLATE_NOOP("palette", "String tunings"))->setElementTranslated(true);

sp->appendActionIcon(ActionIconType::STANDARD_BEND, "standard-bend", 1.25);
Expand Down

0 comments on commit a5a3ff9

Please sign in to comment.