Skip to content

Commit

Permalink
Treat more text formating options as unstyled
Browse files Browse the repository at this point in the history
to enable the reset to style button
  • Loading branch information
Jojo-Schmitz committed Apr 20, 2024
1 parent 80d8493 commit bfcf2aa
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/engraving/dom/textbase.cpp
Expand Up @@ -1918,10 +1918,12 @@ bool TextBase::prepareFormat(const String& token, CharFormat& format, String& pr
format.setStrike(false);
} else if (token == "sub") {
format.setValign(VerticalAlignment::AlignSubScript);
return true;
} else if (token == "/sub") {
format.setValign(VerticalAlignment::AlignNormal);
} else if (token == "sup") {
format.setValign(VerticalAlignment::AlignSuperScript);
return true;
} else if (token == "/sup") {
format.setValign(VerticalAlignment::AlignNormal);
} else if (token.startsWith(u"font ")) {
Expand Down Expand Up @@ -1967,9 +1969,19 @@ bool TextBase::prepareFormat(const String& token, CharFormat& format, String& pr
//---------------------------------------------------------
void TextBase::prepareFormat(const String& token, TextCursor& cursor, String& prevFontFace, double& prevFontSize)
{
if (prepareFormat(token, *cursor.format(), prevFontFace, prevFontSize)
&& cursor.format()->fontFamily() != propertyDefault(Pid::FONT_FACE).value<String>()) {
setPropertyFlags(Pid::FONT_FACE, PropertyFlags::UNSTYLED);
if (prepareFormat(token, *cursor.format(), prevFontFace, prevFontSize)) {
if (cursor.format()->fontFamily() != propertyDefault(Pid::FONT_FACE).value<String>()) {
setPropertyFlags(Pid::FONT_FACE, PropertyFlags::UNSTYLED);
}
if (cursor.format()->fontSize() != propertyDefault(Pid::FONT_SIZE).value<double>()) {
setPropertyFlags(Pid::FONT_SIZE, PropertyFlags::UNSTYLED);
}
if (cursor.format()->style() != propertyDefault(Pid::FONT_STYLE).value<FontStyle>()) {
setPropertyFlags(Pid::FONT_STYLE, PropertyFlags::UNSTYLED);
}
if (cursor.format()->valign() != propertyDefault(Pid::TEXT_SCRIPT_ALIGN).value<VerticalAlignment>()) {
setPropertyFlags(Pid::TEXT_SCRIPT_ALIGN, PropertyFlags::UNSTYLED);
}
}
}

Expand Down

0 comments on commit bfcf2aa

Please sign in to comment.