Hi Aleksa,

Am 16.12.25 um 00:29 schrieb A Jakovljevic:
Hi Lukas,

That almost works as intended, but for rests of 12-15 measures (and 28-31, &c), is not quite correct when compared with historical examples:
image.png
I do not so to say "speak" Scheme fluently, but after some attempts, the solution appears to be a simple change to the "when" statement:
(when (or (equal? glyph "rests.M3") (equal? glyph "rests.M2"))

Ah yes, I didn't think of what happens when M2 rests enter the picture. Your proposed change is fine, but maybe it would help for clarity then to rename the variable "encountered-MM3?" to something like "encountered-shiftable-rest?"

It wasn't the first time I had to resort to cracking open a complete stencil delivered by LilyPond's core engine (the last time, IIRC, was about coloring the elements of a key signature independently from one another). If such a stencil comes from a part of LilyPond that is already written in Scheme, then it's easy to implement any desired change by copying the relevant Scheme code into a .ly file and change it at will. If it's written in C++, that would require re-creating the relevant portion of LilyPond in Scheme (whicth can usually be done and might in some cases even be desirable to do). But if the latter is not an option, I think we would need a flexible infrastructure for manipulating stencil expressions. It shouldn't be too hard to implement something like a stencil-expr-map analogous to music-map, so a routine like the one I proposed might be implemented in a much more elegant and robust manner than the pressed-for-time hack I did yesterday can hope to be.

Anyway, glad to be of help
Lukas

Reply via email to