2 lyric-engraver.cc -- implement Lyric_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 Jan Nieuwenhuizen <janneke@gnu.org>
10 #include "lyric-engraver.hh"
11 #include "musical-request.hh"
12 #include "text-item.hh"
13 #include "paper-def.hh"
15 #include "paper-def.hh"
17 #include "dimensions.hh"
19 ADD_THIS_TRANSLATOR(Lyric_engraver);
21 Lyric_engraver::Lyric_engraver()
26 Lyric_engraver::do_try_music (Music*r)
28 if (Lyric_req* l = dynamic_cast <Lyric_req *> (r))
30 lyric_req_l_arr_.push (l);
37 Lyric_engraver::do_process_requests()
39 if (text_p_arr_.size ())
42 Scalar style = get_property ("textstyle");
43 Scalar alignment = get_property ("textalignment");
44 for (int i=0; i < lyric_req_l_arr_.size (); i++)
46 Lyric_req* request_l = lyric_req_l_arr_[i];
47 Text_def* text_p = new Text_def;
48 text_p->text_str_ = request_l->text_str_;
49 text_p->align_dir_ = LEFT;
50 if (style.length_i ())
51 text_p->style_str_ = style;
52 if (alignment.isnum_b())
53 text_p->align_dir_= (Direction)(int)alignment;
55 Text_item* item_p = new Text_item (text_p);
57 item_p->fat_b_ = true;
59 // item_p->translate (Offset (0, (i - 1) * item_p->height ().length_i ()));
60 // if (i && ((Text_def*)text_p_arr_[i - 1]->tdef_p_)->text_str_.length_i ())
61 // urg, when/how can one get the heigt of this thing?
62 item_p->translate (Offset (0, - i * 12 PT));
63 text_p_arr_.push (item_p);
64 announce_element (Score_element_info (item_p, request_l));
69 Lyric_engraver::do_post_move_processing()
74 Lyric_engraver::do_pre_move_processing()
76 for (int i=0; i < text_p_arr_.size (); i++)
78 typeset_element (text_p_arr_[i]);
81 lyric_req_l_arr_.clear ();