You guys are awesome! Took me a little bit to piece everything together, but here's what I wound up with. It's almost exactly what I want - I still need to figure out how to highlight clef changes in the first bar without highlighting the initial clef indicator, and how to deal with clef modifiers.
clef-highlight-engraver = #(lambda (context) (let ((clef-props '())) `((acknowledgers (clef-interface . ,(lambda (engraver grob source-engraver) ;; Only change items that are non-default (if (boolean? (ly:grob-property grob 'non-default)) (begin ;; Grab all of the data necessary (let* ((clef (ly:clef::print grob)) ;; The existing print object (X-ext (ly:stencil-extent clef X)) ;; The X extent of the grob (Y-ext (ly:stencil-extent clef Y))) ;; The Y extent of the grob ;; Pad the X extent just a bit to make it look more like a highlighter (set! X-ext (cons (- (car X-ext) 0.25) (+ (cdr X-ext) 0.25))) ;; If the clef is a bass clef, then we need to add just a smidge extra to the Y extent ;; This is purely an aesthetic choice on my part, because I think the Y extent of the ;; bass clef is a little off. (if (equal? (ly:context-property context 'clefGlyph) "clefs.F") (set! Y-ext (cons (car Y-ext) (+ (cdr Y-ext) 0.15)))) ;; Don't do this for the initial clef ;; NOTE: If you have a clef change in the first bar, it won't be highlighted. ;; Is there a better way to determine the first (and only the first) clef change? (if (not (equal? (ly:context-property context 'currentBarNumber) 1)) (begin (set! (ly:grob-property grob 'layer) -10) (set! (ly:grob-property grob 'stencil) (ly:stencil-add (ly:make-stencil (list 'color (x11-color 'yellow) (ly:stencil-expr (ly:round-filled-box X-ext Y-ext 0)) X-ext Y-ext)) clef))))))))))))) Thanks again for your help! --Steven _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user