Hello,

I have three ideas for maybe useful features for Lilypond:

First, Lilypond is very strict about what values grob/context properties can 
take. While this is generally a good thing it can be hindering, as properties 
are more or less hard coded. So I suggest that maybe we could have some sort 
of identifier for „custom” properties that skip the type check. This would be 
useful for extended scripting where we want to store arbitrary information.

For example we might have Staves that should behave differently if certain 
other Staves are present. E.g. if we have some splitted staves and we want to 
have voices behave differently depending on whether they are in a separate 
staff or in the common staff. So for this it would be nice if we could simply 
save information in the Staff context that tells us things like how many 
different Parts we currently have in the Staff, for example.

For example we could handle properties that begin with „custom” as custom 
properties, so we could say \override Staff.custom-my-property = something.

Second it would be very useful if we could somehow give engravers some sort of 
filtering option that would allow us to make them not to listen to certain 
events, so that we’d basically be able to disable/enable engravers outside of 
withing the score, or even disable engravers for certain Types of events or 
for events that fit some condition (like having a certain tag).

Third: Using font-features with Lilypond is a bit weird, as using \override 
#'(font-features featureA featureB bla bla . ()) will override any previously 
applied font-features. So I suggest adding markup functions addFontFeature and 
removeFontFeature like in the appended example to make this easier.

What are your takes on this?

Cheers,
Valentin
#(define-markup-command (addFontFeature layout props feat m) (string? markup?)
   (let ((feats (ly:chain-assoc-get 'font-features props '())))
     (interpret-markup layout props
     (if (member feat feats)
         m
         (markup #:override (cons 'font-features (cons feat feats)) m)))))

#(define-markup-command (removeFontFeature layout props feat m) (string? markup?)
   (define (false-if-empty l) (if (null? l) #f l))
   (let ((feats (ly:chain-assoc-get 'font-features props '())))
     (interpret-markup layout props
     (if (not (member feat feats))
         m
         (markup #:override (cons 'font-features (false-if-empty (delete feat feats))) m)))))

\paper {
  #(define fonts
        (make-pango-font-tree "TeX Gyre Schola"
                            "TeX Gyre Heros"
                            "TeX Gyre Cursor"
                            1))
}

\markup { regular123 \addFontFeature "onum" { add123 \removeFontFeature "onum" add+remove123 add-after-remove123 } }

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to