From a5a3ff9fdece5f9f121726caf2f5746a4f6fd065 Mon Sep 17 00:00:00 2001 From: Michele Spagnolo Date: Wed, 29 Nov 2023 16:27:32 +0100 Subject: [PATCH] Refine engraving of StringTuning elements Swap figure-dash with n-dash character. Set default size to 9pt. --- src/engraving/dom/stringtunings.cpp | 2 +- src/engraving/dom/stringtunings.h | 2 +- src/engraving/style/styledef.cpp | 2 ++ src/engraving/style/styledef.h | 2 ++ src/engraving/style/textstyle.cpp | 19 ++++++++++++++++++- src/palette/internal/palettecreator.cpp | 2 +- 6 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/engraving/dom/stringtunings.cpp b/src/engraving/dom/stringtunings.cpp index 290062c47de9f..227dab926682a 100644 --- a/src/engraving/dom/stringtunings.cpp +++ b/src/engraving/dom/stringtunings.cpp @@ -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" "); } } diff --git a/src/engraving/dom/stringtunings.h b/src/engraving/dom/stringtunings.h index 66a9e395c6533..d1bb85371b0d2 100644 --- a/src/engraving/dom/stringtunings.h +++ b/src/engraving/dom/stringtunings.h @@ -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; diff --git a/src/engraving/style/styledef.cpp b/src/engraving/style/styledef.cpp index 9244a9bf1f6e9..9685dd6a9b61e 100644 --- a/src/engraving/style/styledef.cpp +++ b/src/engraving/style/styledef.cpp @@ -820,6 +820,8 @@ const std::array 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 }, diff --git a/src/engraving/style/styledef.h b/src/engraving/style/styledef.h index 7b67f0b6aec15..b6c8e311a802a 100644 --- a/src/engraving/style/styledef.h +++ b/src/engraving/style/styledef.h @@ -832,6 +832,8 @@ enum class Sid { stringNumberOffset, preferSameStringForTranspose, + stringTuningsFontSize, + harpPedalDiagramFontFace, harpPedalDiagramFontSize, harpPedalDiagramLineSpacing, diff --git a/src/engraving/style/textstyle.cpp b/src/engraving/style/textstyle.cpp index d639e45a07c54..8033792d429e7 100644 --- a/src/engraving/style/textstyle.cpp +++ b/src/engraving/style/textstyle.cpp @@ -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 }, @@ -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; diff --git a/src/palette/internal/palettecreator.cpp b/src/palette/internal/palettecreator.cpp index 85206f8bcf8c0..959688da81a56 100644 --- a/src/palette/internal/palettecreator.cpp +++ b/src/palette/internal/palettecreator.cpp @@ -1856,7 +1856,7 @@ PalettePtr PaletteCreator::newGuitarPalette(bool defaultPalette) auto stringTunings = makeElement(gpaletteScore); stringTunings->setXmlText(u"guitarString6 - 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);