api: segno and coda suport#203
Merged
Merged
Conversation
Widen mx::api SegnoData and CodaData to carry font, smufl, and id in addition to position and color, and add the writer path so segno and coda now survive an api round-trip. The reader set colorData but never isColorSpecified, so color was dropped; the writer emitted nothing for segno or coda.
gen-quality
|
Coverage reportCore-dev coverage
|
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 77.9% | 28539 / 36620 |
| Functions | 74.4% | 6360 / 8548 |
| Branches | 50.7% | 22672 / 44725 |
API coverage src/private/mx/{api,impl,utility}/
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 71.4% | 5181 / 7260 |
| Functions | 59.9% | 1815 / 3029 |
| Branches | 42.5% | 4322 / 10169 |
Core HTML report | API HTML report
Commit 711beff9b90591806b14f870563027242bf34185.
This was referenced Jun 17, 2026
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.
Summary
mx::apiexposedSegnoData/CodaDatabut support was partial: the reader only captured positionand color (and even then never set
isColorSpecified, so color was dropped), and the writer emittednothing for segno or coda, silently losing them on write.
This widens both data classes to the full
<segno>/<coda>attribute surface and makes the triplossless in both directions:
fontData,smufl(+isSmuflSpecified), andid(+isIdSpecified) toSegnoDataandCodaData. Position and halign/valign already ride along inpositionData.DirectionReader::parseSegno/parseCodanow read font, smufl, id, and setisColorSpecified.DirectionWriternow writes segno and coda (position, font, color, smufl, id), replacing thelossy
MX_UNUSEDstub proposed in the superseded PR.Note:
positionDatacarries aplacementmember that does not apply to<segno>/<coda>(placement lives on the parent
<direction>). The read/write helpers are attribute-tolerant(
if constexpr (requires ...)), so this is inert, not a data bug. Documented in the headers.Testing
segnoAndCodaRoundTrip_DirectionWriter: builds a segno and a codawith every field set, writes via
DirectionWriter, reads back viaDirectionReader, assertsequality. Passes (8 assertions in 2 test cases with the existing ottava test).
make devbuilds clean;make fmtapplied.make testdeferred to CI.TODO (planned, not done in this PR)
data/synthetic/segno.{3.0,3.1}.xmlandcoda.{3.0,3.1}.xml(register them inMxFileRepository) so the publicDocumentManagerpath isexercised, not just the impl layer. These fixtures already carry every attribute (the 3.1 variants
add
idandsmufl).DirectionWriter#205 Implement rehearsal writing inDirectionWriter. Rehearsals are read but not written; PR Add support for segno reading #134bundled a lossy rehearsal writer. Scoped out here to keep this segno/coda-only.
DirectionWriterignoresorderedComponents— interleaved direction-type children lose original order on write #206 HonororderedComponentsinDirectionWriter. The writer emits each component kind in its ownloop (segnos, then codas), so direction-type children interleaved with other kinds are not
guaranteed to round-trip in original order. Pre-existing limitation surfaced by this work.
parseWordsnever setsWordsData.isColorSpecified— words color does not round-trip #207 Fix the same latent bug inparseWords:WordsData.isColorSpecifiedis never set on read, sowords color does not round-trip (same bug class fixed here for segno/coda).
References