1\version "2.19.24"
2
3\header {
4  texidoc = "The @code{\\applyOutput} expression is the most flexible way to
5tune properties for individual grobs.
6
7Here, the layout of a note head is changed depending on its vertical
8position.
9"
10}
11
12#(define (mc-squared gr org cur)
13   (let ((sp (ly:grob-property gr 'staff-position)))
14     (ly:grob-set-property!
15      gr 'stencil
16      (grob-interpret-markup gr
17			     #{ \markup \raise #-0.5
18				#(case sp
19				   ((-5) "m")
20				   ((-3) "c ")
21				   ((-2) #{ \markup \teeny \bold 2 #})
22				   (else "bla")) #}))))
23
24\new Voice \relative {
25  \set autoBeaming = ##f
26
27  <d' f g b>8
28
29  \applyOutput Voice.NoteHead #mc-squared
30  <d f g b>8
31}
32