X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Documentation%2Fsnippets%2Fnew%2Fcentering-markup-on-note-heads-automatically.ly;fp=Documentation%2Fsnippets%2Fnew%2Fcentering-markup-on-note-heads-automatically.ly;h=1e6ffa7b9ec9948a472e674e23239c2f50ff6f72;hb=32a34dcef0c0041c6d62677487a380b5c8b85712;hp=47169a559bd1c801a0e18a3336793f2869e5b813;hpb=f41973ff763d5972a85995b6d40c864281ec6714;p=lilypond.git diff --git a/Documentation/snippets/new/centering-markup-on-note-heads-automatically.ly b/Documentation/snippets/new/centering-markup-on-note-heads-automatically.ly index 47169a559b..1e6ffa7b9e 100644 --- a/Documentation/snippets/new/centering-markup-on-note-heads-automatically.ly +++ b/Documentation/snippets/new/centering-markup-on-note-heads-automatically.ly @@ -1,4 +1,4 @@ -\version "2.14.0" +\version "2.16.0" \header { lsrtags = "text, tweaks-and-overrides, contexts-and-engravers" @@ -17,29 +17,23 @@ been shifted via @code{force-hshift}. #(define (Text_align_engraver ctx) (let ((scripts '()) (note-column #f)) - - `((acknowledgers - (note-column-interface - . ,(lambda (trans grob source) - ;; cache NoteColumn in this Voice context - (set! note-column grob))) - - (text-script-interface - . ,(lambda (trans grob source) - ;; whenever a TextScript is acknowledged, - ;; add it to `scripts' list - (set! scripts (cons grob scripts))))) - - (stop-translation-timestep - . ,(lambda (trans) - ;; if any TextScript grobs exist, - ;; set NoteColumn as X-parent - (and (pair? scripts) - (for-each (lambda (script) - (set! (ly:grob-parent script X) note-column)) - scripts)) - ;; clear scripts ready for next timestep - (set! scripts '())))))) + (make-engraver + (acknowledgers + ((note-column-interface trans grob source) + ;; cache NoteColumn in this Voice context + (set! note-column grob)) + ((text-script-interface trans grob source) + ;; whenever a TextScript is acknowledged, + ;; add it to `scripts' list + (set! scripts (cons grob scripts)))) + ((stop-translation-timestep trans) + ;; if any TextScript grobs exist, + ;; set NoteColumn as X-parent + (for-each (lambda (script) + (set! (ly:grob-parent script X) note-column)) + scripts) + ;; clear scripts ready for next timestep + (set! scripts '()))))) \layout { \context {