2 lyric-phrasing-engraver.hh -- declare Lyric_phrasing_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000 Glen Prideaux <glenprideaux@iname.com>
10 #ifndef LYRIC_PHRASING_ENGRAVER_HH
11 #define LYRIC_PHRASING_ENGRAVER_HH
13 #include "lily-proto.hh"
14 #include "engraver.hh"
22 Align lyrics with noteheads, left aligning beginning of phrases,
23 right aligning end of phrases, centering others under their notes.
28 * Build an engraver that catches noteheads and lyrics.
30 (It needs to be in a context above Staff and Lyrics, eg. in Score
33 * Determine which heads belong to which lyrics
35 (eg. by looking at the names of their originating contexts, or maybe
38 * Attach the lyrics to the appropriate heads
40 (by doing lyric->set_parent (head, X_AXIS), that will fix the current
41 noteheadwidth guessing kludge)
43 * Check if the lyric syllables end or start a phrase.
45 (eg. check if the syllable ends with punctuation, and remember that
46 fact for the next one.)
48 * Adjust their alignment accordingly.
50 (eg. by doing lyric->add_offset_callback(centered_on_parent,X_AXIS)
51 and setting self-alignment-X)
53 * Add a property to switch on/off the engraver (for multi stanza
54 vs. single stanza music)
56 Maybe this engraver could also take care of correct lyric alignment
63 class Lyric_phrasing_engraver : public Engraver
66 virtual void acknowledge_element(Score_element_info);
67 virtual void process_acknowledged ();
68 virtual void do_pre_move_processing();
71 void record_notehead(const String &context_id, Score_element * notehead);
72 void record_lyric(const String &context_id, Score_element * lyric);
73 void record_melisma(const String &context_id);
74 void record_extender(const String &context_id, Score_element * extender);
75 Syllable_group * lookup_context_id(const String &context_id);
78 Lyric_phrasing_engraver ();
79 ~Lyric_phrasing_engraver ();
80 VIRTUAL_COPY_CONS (Translator);
83 /** association list of Syllable_group smobs
85 Protected_scm voice_alist_;
86 Score_element * any_notehead_l_;
92 bool first_in_phrase_b_;
93 Score_element * notehead_l_;
94 Link_array<Score_element> lyric_list_;
95 Score_element * longest_lyric_l_;
96 Score_element * shortest_lyric_l_;
99 Real group_translation_f_;
101 static SCM make_entry();
102 void set_first_in_phrase(bool f);
103 void set_notehead(Score_element * notehead);
104 void add_lyric(Score_element * lyric);
105 void add_extender(Score_element * extender);
106 void set_melisma() { melisma_b_ = true; }
107 bool get_melisma() { return melisma_b_; }
108 int lyric_count() { return lyric_list_.size(); }
111 bool set_lyric_align(const char *punc, Score_element *default_notehead_l);
112 void adjust_melisma_align();
113 int appropriate_alignment(const char *punc);
114 Real amount_to_translate();
116 void copy(Syllable_group *);
119 DECLARE_SIMPLE_SMOBS(Syllable_group,);
122 Syllable_group * unsmob_voice_entry (SCM);
125 #endif // LYRIC_PHRASING_ENGRAVER_HH