4 lsrtags
= "tweaks-and-overrides"
7 Some grobs can be accessed @qq{laterally} from within another grob's
8 callback. These are usually listed as @qq{layout objects} in the
9 @qq{Internal properties} section of a grob-interface. The function
10 @code{ly:grob-object} is used to access these grobs.
13 Demonstrated below are some ways of accessing grobs from within a
14 NoteHead callback, but the technique is not limited to NoteHeads.
15 However, the NoteHead callback is particularly important, since it is
16 the implicit callback used by the @code{\\tweak} command.
19 The example function defined below (\"display-grobs\") is probably not
20 that useful, but it demonstrates that the grobs are indeed being
24 Example console output:
36 doctitle
= "Using ly:grob-object to access grobs with \\tweak"
39 #(define
(notehead-get-accidental notehead
)
41 (ly
:grob-object notehead
'accidental-grob
))
43 #(define
(notehead-get-arpeggio notehead
)
45 (let
((notecolumn
(notehead-get-notecolumn notehead
)))
46 (ly
:grob-object notecolumn
'arpeggio
)))
48 #(define
(notehead-get-notecolumn notehead
)
50 (ly
:grob-parent notehead X
))
52 #(define
(notehead-get-stem notehead
)
54 (let
((notecolumn
(notehead-get-notecolumn notehead
)))
55 (ly
:grob-object notecolumn
'stem
)))
57 #(define
(display-grobs notehead
)
59 (let
((accidental
(notehead-get-accidental notehead
))
60 (arpeggio
(notehead-get-arpeggio notehead
))
61 (stem
(notehead-get-stem notehead
)))
62 (format
#t
"~2&~a\n" (make-string
20 #\-
))
64 (lambda
(x
) (format
#t
"~a\n" x
))
65 (list accidental arpeggio stem
))))
68 %% display grobs for each note head:
69 %\override NoteHead #'before-line-breaking = #display-grobs
72 \tweak #'before-line-breaking
#display-grobs