Open ajyoon opened 2 years ago
We might want to consider checking out Musescore's accidental layout algorithm since they also use SMuFL
See MuseScore's implementation here - https://github.com/musescore/MuseScore/blob/751c0866abbceb011d2747d9992a584f0675a562/src/engraving/layout/layoutchords.cpp#L621 - it is indeed pretty complicated
I've improved the situation considerably with fdbd1c3d461299311 but it still leaves much to be desired. Issue summary has been updated accordingly
Just noticed that naturals are too close to noteheads in chordrests - I know it doesn't look like it, but this actually is a chordrest with a special table:
table = NoteheadTable(double_whole='noteheadBlack', whole='noteheadBlack', half='noteheadBlack', short='noteheadBlack')
Chordrest
currently uses a very basic algorithm for laying out accidentals - it works through the accidentals from top to bottom, and if a bounding rect collision with the previous accidental is found (and that previous accidental is not shifted), it shifts the accidental to the left edge of the previous accidental's bounding rect. This works for many cases, but causes bad results for some common cases like these:Users can currently work around this by manually adjusting X positions of accidental glyphs with something like:
But this is very tedious and modifications don't survive chord rebuilds (which can be triggered by things like beaming). We should implement an accidental layout algorithm according to standard notation conventions. From what I've seen the rules are pretty complicated, so it may be an involved fix. A proper solution should also take into account glyph cutouts provided by SMuFL for this purpose.