2 hyphen-engraver.cc -- implement Hyphen_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1999--2003 Glen Prideaux <glenprideaux@iname.com>
9 #include "flower-proto.hh"
11 #include "hyphen-spanner.hh"
12 #include "paper-column.hh"
14 #include "engraver.hh"
17 Generate an centred hyphen. Should make a Hyphen_spanner that
18 typesets a nice centred hyphen of varying length depending on the
19 gap between syllables.
21 We remember the last Item that come across. When we get a
22 event, we create the spanner, and attach the left point to the
23 last lyrics, and the right point to any lyrics we receive by
25 class Hyphen_engraver : public Engraver
32 TRANSLATOR_DECLARATIONS(Hyphen_engraver);
35 virtual void acknowledge_grob (Grob_info);
36 virtual void finalize ();
37 virtual bool try_music (Music*);
38 virtual void stop_translation_timestep ();
39 virtual void start_translation_timestep ();
40 virtual void process_acknowledged_grobs ();
47 Hyphen_engraver::Hyphen_engraver ()
56 Hyphen_engraver::acknowledge_grob (Grob_info i)
59 if (i.grob_->internal_has_interface (ly_symbol2scm ("lyric-syllable-interface")))
61 current_lyric_ = i.grob_;
63 && !hyphen_->get_bound (RIGHT)
66 Hyphen_spanner (hyphen_).set_textitem (RIGHT, i.grob_);
73 Hyphen_engraver::try_music (Music* r)
83 Hyphen_engraver::finalize ()
87 req_->origin ()->warning (_ ("unterminated hyphen"));
88 hyphen_->set_bound (RIGHT, unsmob_grob (get_property ("currentCommandColumn")));
93 Hyphen_engraver::process_acknowledged_grobs ()
99 req_->origin ()->warning (_ ("Nothing to connect hyphen to on the left. Ignoring hyphen event."));
103 hyphen_ = new Spanner (get_property ("LyricHyphen"));
105 Hyphen_spanner (hyphen_).set_textitem (LEFT, last_lyric_);
106 announce_grob(hyphen_, req_->self_scm());
112 Hyphen_engraver::stop_translation_timestep ()
116 typeset_grob (hyphen_);
122 last_lyric_ = current_lyric_;
128 Hyphen_engraver::start_translation_timestep ()
134 ENTER_DESCRIPTION(Hyphen_engraver,
135 /* descr */ "Create lyric hyphens",
136 /* creats*/ "LyricHyphen",
137 /* accepts */ "hyphen-event",
138 /* acks */ "lyric-syllable-interface",