More automated:
\version "2.16.0"
chordNamesWithRestsLayout =
\with {
noChordSymbol = #(make-simple-markup "")
\consists "Rest_engraver"
\consists "Multi_measure_rest_engraver"
\override Rest #'font-size = #-4
\override MultiMeasureRest #'font-size = #-4
% No idea, why r1 needs to be special-cased:
\override Rest #'after-line-breaking =
#(lambda (grob)
(let* ((dur-log (ly:grob-property grob 'duration-log))
(staff-pos (if (= dur-log 0) 0 2)))
(ly:grob-set-property! grob 'staff-position staff-pos)))
\override MultiMeasureRest #'staff-position = #2
}
<<
\new ChordNames \with { \chordNamesWithRestsLayout }
\chordmode { c1 R1 d e }
\new Staff { c1 R1 d e }
>>
\score {
<<
\new ChordNames
\chordmode { c1 R1 d e }
\new Staff { c1 R1 d e }
>>
\layout {
\context {
\ChordNames
\chordNamesWithRestsLayout
}
}
}