Changing properties for individual grobs: Difference between revisions

No edit summary
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
The <code>\applyOutput</code> command allows the tuning of any layout object, in any context. It requires a Scheme function with three arguments.
The <code>\applyOutput</code> command allows the tuning of any layout object, in any context. It requires a Scheme function with three arguments.
In the example below, function <code>mc-squared</code> is executed for all <code>NoteHead</code> grobs (within the current <code>Voice</code> context) at the current time step; the function modifies the grob's <code>stencil</code>, using the <code>staff-position</code> property to replace some pitches with markup.
See the [{{LILYSTABLEDOC}}/extending/running-a-function-on-all-layout-objects ‘Extending’ manual] for more information.


<lilypond version="2.24">
<lilypond version="2.24">
Line 7: Line 11:
       grob 'stencil
       grob 'stencil
       (grob-interpret-markup grob
       (grob-interpret-markup grob
    #{ \markup \lower #0.5
      #{ \markup \lower #0.5
#(case sp
          #(case sp
  ((-5) "m")
              ((-5) "m")
  ((-3) "c ")
              ((-3) "c ")
  ((-2) #{ \markup \teeny \bold 2 #})
              ((-2) #{ \markup \teeny \bold 2 #})
  (else "bla")) #}))))
              (else "bla")) #}))))


\relative c' {
\relative c' {
Line 21: Line 25:
</lilypond>
</lilypond>


[[Category:Really cool]]
[[Category:Scheme]]
[[Category:Scheme]]
[[Category:Tweaks and overrides]]
[[Category:Tweaks and overrides]]
[[Category:Scheme]]
[[Category:Included in the official documentation]]
[[Category:Really cool]]
[[Category:Snippet]]
[[Category:Included in the official documentation]][[Category:Snippet]]