-containing procedures. These procedure perform the actual formatting,
-and by substituting different ones, we can change behavior. In the
-following example, the rule that note head objects use to produce
-their symbol is changed during the music fragment:
-
-
-@lilypond[raggedright]
-#(define (mc-squared gr org cur)
- (let*
- ((ifs (ly:grob-property gr 'interfaces))
- (sp (ly:grob-property gr 'staff-position)) )
- (if (and (memq 'note-head-interface ifs)
- (memq sp '(-2 -3 -5)))
- (begin
- (ly:grob-set-property! gr 'print-function brew-new-markup-stencil)
- (ly:grob-set-property! gr 'font-family 'roman)
- (ly:grob-set-property!
- gr 'text
- (make-raise-markup -0.5
- (case sp
- ((-5) (make-simple-markup "m"))
- ((-3) (make-simple-markup "c "))
- ((-2) (make-smaller-markup (make-bold-markup "2")))
- (else (make-simple-markup "bla"))
- ))))
- )))
-
-\score {
- \notes \context Voice \relative c'
- {
- \stemUp
- \set autoBeaming = ##f
- \time 2/4
- { <d f g>4
- \once \override NoteHead #'print-function
- = #Note_head::brew_ez_stencil
- <d f g>
- \once \override NoteHead #'style
- = #'cross
- <d f g>
- \applyoutput #mc-squared
- <d f g>
- << { d8[ es-( fis^^ g] fis2-) }
- \repeat unfold 5 { \applyoutput #mc-squared s8 } >>
-
- }
-
- }
+containing procedures. These procedures perform the actual
+formatting, and by substituting different ones, we can change the
+appearance of objects. In the following example, the rule which note
+head objects use to produce their symbol is changed during the music
+fragment.
+
+@c FIXME: this example has errors:
+@c programming error: Grob `NoteHead' has no interface for property `text'
+@c Continuing; crossing fingers
+@lilypond[quote,raggedright]
+#(define (mc-squared grob orig current)
+ (let ((interfaces (ly:grob-property grob 'interfaces))
+ (pos (ly:grob-property grob 'staff-position)))
+ (if (and (memq 'note-head-interface interfaces)
+ (memq pos '(-2 -3 -5)))
+ (begin
+ (ly:grob-set-property! grob 'print-function brew-new-markup-stencil)
+ (ly:grob-set-property! grob 'font-family 'roman)
+ (ly:grob-set-property!
+ grob 'text
+ (make-raise-markup
+ -0.5
+ (case pos
+ ((-5) (make-simple-markup "m"))
+ ((-3) (make-simple-markup "c "))
+ ((-2) (make-smaller-markup (make-bold-markup "2")))
+ (else (make-simple-markup "bla")))))))))
+
+\new Voice \relative c' {
+ \stemUp
+ \set autoBeaming = ##f
+ \time 2/4
+ <d f g>4
+ \once \override NoteHead #'print-function = #Note_head::brew_ez_stencil
+ <d f g>
+ \once \override NoteHead #'style = #'cross
+ <d f g>
+ \applyoutput #mc-squared
+ <d f g>
+ <<
+ { d8[ es-( fis^^ g] fis2-) }
+ \repeat unfold 5 { \applyoutput #mc-squared s8 }
+ >>