--- /dev/null
+\version "2.19.11"
+\header {
+ texidoc ="Lyrics can be aligned to a @code{NullVoice} context,
+ which prints no notes, with the usual mechanisms for melismata."
+}
+
+\score { <<
+ \new Staff <<
+ { c''4. g'8 c''2 | g'4( f' g'2) } \\
+ { c'4 b c'8 e' g' e' | c'1 }
+ \new NullVoice = "nv" {
+ \autoBeamOff c4 r16 b,16~ b,8 c8[ e8 g8 e8] | g4( f4) g2 }
+ >>
+ \new Lyrics \lyricsto "nv" { free a -- lign -- ment }
+>> }
\context {
\name "NullVoice"
\type "Engraver_group"
-
- \description "Non-printing context, typically used for aligning
-lyrics in polyphonic situations, or with @code{\partcombine}."
+ \description "For aligning lyrics without printing notes"
%% don't route anything out of here
\alias "Staff"
\alias "Voice"
- %% all three are needed for ties to work with lyrics
+ % provide non-printing NoteHeads with proper extents for lyric alignment
\consists "Note_heads_engraver"
- \consists "Rhythmic_column_engraver"
- \consists "Tie_engraver"
-
- %% both are needed for melismas to work with \autoBeamOff
- \consists "Beam_engraver"
- \consists "Stem_engraver"
-
- %% needed for slurs to work with lyrics
- \consists "Slur_engraver"
-
+ \omit NoteHead
+ \override NoteHead.X-extent = #(lambda (g)
+ (ly:stencil-extent (ly:note-head::print g) X))
+ % rhythmic-head-interface needs Rhythmic_column_engraver, which we don't want
+ \override NoteHead.meta.interfaces = #(delete 'rhythmic-head-interface
+ (assoc-get 'interfaces
+ (assoc-get 'meta
+ (assoc-get 'NoteHead
+ all-grob-descriptions))))
%% keep noteheads inside the staff
\consists "Pitch_squash_engraver"
squashedPosition = 0
- %% `\omit NoteHead' would give slur attachment errors
\omit Accidental
+ \omit AccidentalCautionary
+ \omit AccidentalSuggestion
+
+ % the engravers that control the 'busy' flags for note-onsets and melismata
+ \consists "Grob_pq_engraver"
+ \consists "Tie_engraver"
+ \omit Tie
+ \consists "Beam_engraver"
\omit Beam
- \omit Dots
- \omit Flag
- \omit Rest
+ \consists "Slur_engraver"
\omit Slur
- \omit Stem
- \omit Tie
-
- %% let these take up space (for lyric extenders, etc.)
- \override NoteHead.transparent = ##t
- \override TabNoteHead.transparent = ##t
-
- %% don't let notes shift
- \override NoteHead.X-offset = 0
- \override NoteColumn.ignore-collision = ##t
-
- %% keep beams and stems inside the staff
- \override Beam.positions = #'(1 . 1)
- \override Stem.length = 0
-
- %% prevent "weird stem size" warnings
- \override Stem.direction = #UP
}
\context {