Skip to content

Commit

Permalink
Use musical text font for markers & keep palette at size 18
Browse files Browse the repository at this point in the history
  • Loading branch information
miiizen committed Sep 26, 2024
1 parent 058263c commit 093a3eb
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 18 deletions.
2 changes: 0 additions & 2 deletions src/engraving/dom/textbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -888,8 +888,6 @@ Font TextFragment::font(const TextBase* t) const
|| t->textStyleType() == TextStyleType::HARP_PEDAL_DIAGRAM
|| t->textStyleType() == TextStyleType::TUPLET
|| t->textStyleType() == TextStyleType::PEDAL
|| t->textStyleType() == TextStyleType::REPEAT_LEFT
|| t->textStyleType() == TextStyleType::REPEAT_RIGHT
) {
std::string fontName = engravingFonts()->fontByName(t->style().styleSt(Sid::musicalSymbolFont).toStdString())->family();
family = String::fromStdString(fontName);
Expand Down
5 changes: 5 additions & 0 deletions src/engraving/rw/read410/tread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1875,6 +1875,11 @@ void TRead::read(Marker* m, XmlReader& e, ReadContext& ctx)
e.unknown();
}
}
const bool needsAdjustMarkerSize = m->score()->mscVersion() == 440 && m->score()->mscoreVersion() != u"4.4.3" && !ctx.pasteMode();
const bool isDefualtSize = m->score()->style().styleD(Sid::repeatLeftFontSize) == 11.0;
if (m->textStyleType() == TextStyleType::REPEAT_LEFT && needsAdjustMarkerSize && isDefualtSize) {
m->setSize(18.0);
}
m->setMarkerType(mt);
}

Expand Down
2 changes: 0 additions & 2 deletions src/engraving/style/styledef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1194,8 +1194,6 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
styleDef(repeatLeftFrameFgColor, PropertyValue::fromValue(Color::BLACK)),
styleDef(repeatLeftFrameBgColor, PropertyValue::fromValue(Color::transparent)),

styleDef(repeatsMusicalSymbolsScale, 1.0), // percentage of the standard size

styleDef(repeatRightFontFace, "Edwin"),
styleDef(repeatRightFontSize, 11.0),
styleDef(repeatRightLineSpacing, 1.0),
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 @@ -1206,8 +1206,6 @@ enum class Sid {
repeatLeftFrameFgColor,
repeatLeftFrameBgColor,

repeatsMusicalSymbolsScale,

repeatRightFontFace,
repeatRightFontSize,
repeatRightLineSpacing,
Expand Down
2 changes: 0 additions & 2 deletions src/engraving/style/textstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,6 @@ const TextStyle repeatLeftTextStyle { {
{ TextStylePropertyType::FrameRound, Sid::repeatLeftFrameRound, Pid::FRAME_ROUND },
{ TextStylePropertyType::FrameBorderColor, Sid::repeatLeftFrameFgColor, Pid::FRAME_FG_COLOR },
{ TextStylePropertyType::FrameFillColor, Sid::repeatLeftFrameBgColor, Pid::FRAME_BG_COLOR },
{ TextStylePropertyType::MusicalSymbolsScale, Sid::repeatsMusicalSymbolsScale, Pid::MUSICAL_SYMBOLS_SCALE },
} };

const TextStyle repeatRightTextStyle { {
Expand All @@ -690,7 +689,6 @@ const TextStyle repeatRightTextStyle { {
{ TextStylePropertyType::FrameRound, Sid::repeatRightFrameRound, Pid::FRAME_ROUND },
{ TextStylePropertyType::FrameBorderColor, Sid::repeatRightFrameFgColor, Pid::FRAME_FG_COLOR },
{ TextStylePropertyType::FrameFillColor, Sid::repeatRightFrameBgColor, Pid::FRAME_BG_COLOR },
{ TextStylePropertyType::MusicalSymbolsScale, Sid::repeatsMusicalSymbolsScale, Pid::MUSICAL_SYMBOLS_SCALE },
} };

const TextStyle frameTextStyle { {
Expand Down
1 change: 0 additions & 1 deletion src/palette/internal/palettecell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ bool PaletteCell::read(XmlReader& e, bool pasteMode)
} else {
rw::RWRegister::reader()->readItem(element.get(), e);
PaletteCompat::migrateOldPaletteItemIfNeeded(element, gpaletteScore);
element->styleChanged();

if (element->type() == ElementType::ACTION_ICON) {
ActionIcon* icon = toActionIcon(element.get());
Expand Down
29 changes: 20 additions & 9 deletions src/palette/internal/palettecompat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include "palettecompat.h"

#include "dom/marker.h"
#include "engraving/rw/compat/compatutils.h"

#include "engraving/dom/actionicon.h"
Expand Down Expand Up @@ -62,17 +63,15 @@ void PaletteCompat::migrateOldPaletteItemIfNeeded(ElementPtr& element, Score* pa
bool isOldOrnament = ornamentIds.find(toArticulation(item)->symId()) != ornamentIds.end();

if (!isOldOrnament) {
element->styleChanged();
return;
}

Articulation* oldOrnament = toArticulation(item);
Ornament* newOrnament = Factory::createOrnament((ChordRest*)(paletteScore->dummy()->chord()));
newOrnament->setSymId(oldOrnament->symId());
element.reset(newOrnament);
return;
}

if (item->isStaffText() && toStaffText(item)->textStyleType() == TextStyleType::EXPRESSION) {
} else if (item->isStaffText() && toStaffText(item)->textStyleType() == TextStyleType::EXPRESSION) {
StaffText* oldExpression = toStaffText(item);
Expression* newExpression = Factory::createExpression(paletteScore->dummy()->segment());
if (oldExpression->xmlText() == "Expression") {
Expand All @@ -81,10 +80,7 @@ void PaletteCompat::migrateOldPaletteItemIfNeeded(ElementPtr& element, Score* pa
newExpression->setXmlText(oldExpression->xmlText());
}
element.reset(newExpression);
return;
}

if (item->isPedal()) {
} else if (item->isPedal()) {
Pedal* newPedal = Factory::createPedal(paletteScore->dummy());
Pedal* oldPedal = toPedal(item);

Expand All @@ -98,7 +94,22 @@ void PaletteCompat::migrateOldPaletteItemIfNeeded(ElementPtr& element, Score* pa
newPedal->setEndText(newPedal->propertyDefault(Pid::END_TEXT).value<String>());

element.reset(newPedal);
return;
}

element->styleChanged();

// from 4.4.3 markers have a font size which is not the default, so this must be reset after calling style changed
if (item->isMarker() && toMarker(item)->size() == 11) {
Marker* oldMarker = toMarker(item);
if (oldMarker->size() != 11 || oldMarker->textStyleType() != TextStyleType::REPEAT_LEFT) {
return;
}
Marker* newMarker = Factory::createMarker(paletteScore->dummy());
newMarker->setMarkerType(oldMarker->markerType());
newMarker->setSize(18);
newMarker->setPropertyFlags(Pid::FONT_SIZE, PropertyFlags::UNSTYLED);

element.reset(newMarker);
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/palette/internal/palettecreator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,10 @@ PalettePtr PaletteCreator::newRepeatsPalette(bool defaultPalette)
auto mk = makeElement<Marker>(gpaletteScore);
mk->setMarkerType(markerType);
mk->styleChanged();
if (mk->textStyleType() == TextStyleType::REPEAT_LEFT) {
mk->setSize(18.0);
mk->setPropertyFlags(Pid::FONT_SIZE, PropertyFlags::UNSTYLED);
}
sp->appendElement(mk, TConv::userName(markerType));
}

Expand Down

0 comments on commit 093a3eb

Please sign in to comment.