Repository navigation
feat: accidental marks keep how they are drawn - #497
Merged
Merged
Conversation
An accidental-mark kept only its value and position. Its parentheses, bracket, size, SMuFL glyph, id, font and color were dropped on read and never written. A standalone accidental mark now carries these in a new AccidentalMarkData alternative of MarkDataChoice, with its font and color in MarkData::printData. A payload with nothing set is none, so a mark built from its MarkType alone still compares equal after a write and a read. An accidental that belongs to an ornament (OrnamentAccidental) gains the same fields directly, plus PrintData. The new SymbolSize enum in ApiCommon.h carries MusicXML's size attribute. The reader and the writer each fill both shapes through one shared helper. A smufl name that is not a SMuFL accidental glyph is not written and is reported as dropped data. Pins synthetic/accidental-mark.3.0.xml and accidental-mark.3.1.xml in the round-trip baseline.
SymbolSize::unspecified leaves the size to the application rather than promising the usual size, and cue and graceCue now follow MusicXML's note-type defaults: cue is the size of a cue note or a grace note, graceCue the size of a note that is both. AccidentalMarkData::size says that a different size is, like parentheses and brackets, a common way to show an editorial accidental, and the payload's comment says that MarkData::printData's printObject is not used for an accidental mark.
Reads a standalone accidental-mark that sets parentheses, bracket, size, font, color, smufl and id, checks each field, and checks the written xml carries each attribute. A bare accidental-mark beside it reads with no payload and default print data. Corrects the comment on AccidentalMarkDefaultsToNoPayload: the mark reads back equal in everything but name, which the reader fills in and the MarkData constructor leaves empty for accidental marks.
webern
force-pushed
the
m/mxdev-accattr
branch
from
November 7, 2026 11:58
1498fb1 to
68f8fc2
Compare
webern
marked this pull request as ready for review
November 7, 2026 12:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI Summary
An accidental-mark lost how it is drawn when read into mx::api and written back. Only its accidental value, position and placement were kept; its parentheses, bracket, size, SMuFL glyph, id, font and color were dropped on read and could not be authored. This applied both to a standalone accidental mark in notations and to an accidental that belongs to an ornament, such as the sharp over a trill.
What changes in mx::api:
The accidental's font and color go in the existing MarkData::printData. A payload with every field at its default is stored as none, so a mark built from its MarkType alone still compares equal after a write and a read.
One reader helper and one writer helper fill both shapes.
Behaviour change for callers reading files
Reading an accidental mark that sets any of parentheses, bracket, size, smufl or id now gives a choice holding AccidentalMarkData where it used to be none. Its MarkData::printData, and an OrnamentAccidental's printData, now holds the font and color from the file where it used to be left at its default. Code that builds accidental marks is unaffected, and nothing was removed or renamed, so this is labelled non-breaking.
Out of scope
Pinned files
Testing
References
mx::api#403 (the accidental-mark id)midi-unpitchedand accidental marks #443 and feat: an ornament owns the accidental marks written after it #496