Hi,
I found an article about music engraving* (in German): http://pian-e-forte.de/texte/pdf/notenschreiben01.pdf
It claims a rule for accidental placement and shows some examples of how chord accidentals are ordered on page 17 (second staff). This corresponds mostly to what LilyPond does, except the chord in the 5th bar (marked with "Here"). LilyPond follows the rule, that the lowest and highest accidentals are placed closest to the chord. But the arrangement of noteheads makes the author of the article change the order of the lower two accidentals, which is easier to read in my opinion, because the distance between the d sharp and its accidental is reduced (this is an exception from the rule, the author stated before).
[to devel]
This does look good - I like the author's choice better than the LilyPond output.
For complicated chords, I'm guessing that it is often the case that LilyPond's current algorithm will miss the optimum result in some subtle way. Given n accidentals (where accidental is the whole group of things next to a note, including cautionaries, parentheses etc.), there are n! orders in which the most complete algorithm possible can place them. So once we're in 6-accidental territory, we're talking about 720 possible orders. It is possible to do accidental configuration "scoring" with a priority queue, very much how we do slurs. But I have no clue how much this would slow the program down.
Cheers, MS |