X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Documentation%2Fsnippets%2Fcentering-markup-on-note-heads-automatically.ly;h=b5342b4131087cb01e02db78f097b8bbe0e1352d;hb=8a50484b054224cfc72b65e63e88287ea812ba53;hp=c599be1556626599091071c071c26ed39ec99af9;hpb=a874fda3641c9e02f61be5c41b215b8304b8ed00;p=lilypond.git diff --git a/Documentation/snippets/centering-markup-on-note-heads-automatically.ly b/Documentation/snippets/centering-markup-on-note-heads-automatically.ly index c599be1556..b5342b4131 100644 --- a/Documentation/snippets/centering-markup-on-note-heads-automatically.ly +++ b/Documentation/snippets/centering-markup-on-note-heads-automatically.ly @@ -1,8 +1,11 @@ -% Do not edit this file; it is automatically +% DO NOT EDIT this file manually; it is automatically % generated from Documentation/snippets/new +% Make any changes in Documentation/snippets/new/ +% and then run scripts/auxiliar/makelsr.py +% % This file is in the public domain. -%% Note: this file works from version 2.13.36 -\version "2.13.40" +%% Note: this file works from version 2.17.6 +\version "2.17.6" \header { lsrtags = "text, tweaks-and-overrides, contexts-and-engravers" @@ -22,43 +25,37 @@ 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 { \Voice \consists #Text_align_engraver - \override TextScript #'X-offset = + \override TextScript.X-offset = #ly:self-alignment-interface::aligned-on-x-parent - \override TextScript #'self-alignment-X = #CENTER + \override TextScript.self-alignment-X = #CENTER } } \new Staff << \relative c'' { - \override NoteColumn #'force-hshift = #3 + \override NoteColumn.force-hshift = #3 c1-\markup { \arrow-head #Y #DOWN ##t } } \\