1 %% Do not edit this file; it is automatically
2 %% generated from LSR http://lsr.dsi.unimi.it
3 %% This file is in the public domain.
7 lsrtags = "text, tweaks-and-overrides"
10 For technical reasons, text scripts attached to note heads cannot
11 easily be centered on a note head's width, unlike articulations.
13 Instead of using trial-and-error offset tweaks, this snippet accesses a
14 note head (or rest) from the @code{TextScript} object's horizontal
15 parent (a paper column), using its extent to correct the positioning.
20 doctitle = "Centering markup on note heads automatically"
23 textScriptCenterOnNote = \override TextScript #'X-offset =
25 (let* ((paper-col (ly:grob-parent grob X))
26 (elts (ly:grob-object paper-col 'elements))
31 (let ((elt (ly:grob-array-ref elts idx)))
32 (if (grob::has-interface elt
33 'rhythmic-grob-interface)
34 (set! rhythmic-head elt))))
35 (reverse (iota (ly:grob-array-length elts))))
38 (ly:self-alignment-interface::x-aligned-on-self grob)
40 (ly:grob-robust-relative-extent rhythmic-head rhythmic-head X)))))
43 \override TextScript #'self-alignment-X = #CENTER
44 \textScriptCenterOnNote
45 <c e g c>1-\markup \arrow-head #Y #UP ##t
46 <c e g c>1-\markup \huge "^"