2 lyric-engraver.cc -- implement Lyric_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 Jan Nieuwenhuizen <janneke@gnu.org>
10 #include "engraver.hh"
11 #include "musical-request.hh"
13 #include "paper-def.hh"
14 #include "font-metric.hh"
15 #include "side-position-interface.hh"
18 Generate texts for lyric syllables. We only do one lyric at a time.
19 Multiple copies of this engraver should be used to do multiple voices.
21 class Lyric_engraver
: public Engraver
24 virtual void stop_translation_timestep ();
25 virtual bool try_music (Music
*);
26 virtual void create_grobs ();
27 virtual void start_translation_timestep ();
31 VIRTUAL_COPY_CONS (Translator
);
38 ADD_THIS_TRANSLATOR (Lyric_engraver
);
41 Lyric_engraver::Lyric_engraver ()
48 Lyric_engraver::try_music (Music
*r
)
50 if (Lyric_req
* l
= dynamic_cast <Lyric_req
*> (r
))
61 Lyric_engraver::create_grobs ()
65 text_p_
= new Item (get_property ("LyricText"));
67 text_p_
->set_grob_property ("text", req_l_
->get_mus_property ("text"));
70 We can't reach the notehead where we're centered from here. So
73 (UGH UGH, pulled amount of space out of thin air)
76 text_p_
->translate_axis (0.66, X_AXIS
);
78 announce_grob (text_p_
, req_l_
);
84 Lyric_engraver::stop_translation_timestep ()
88 typeset_grob (text_p_
);
94 Lyric_engraver::start_translation_timestep ()