]> git.donarmstrong.com Git - lilypond.git/blob - lily/text-item.cc
release: 1.3.56
[lilypond.git] / lily / text-item.cc
1 /*   
2   text-item.cc -- implement Text_item
3
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 1998--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10 #include "text-item.hh"
11 #include "debug.hh"
12 #include "molecule.hh"
13 #include "paper-def.hh"
14 #include "lookup.hh"
15 #include "staff-symbol-referencer.hh"
16
17 Text_item::Text_item (SCM s)
18   : Item (s)
19 {
20   
21 }
22
23 MAKE_SCHEME_SCORE_ELEMENT_CALLBACKS(Text_item)
24
25 Molecule 
26 Text_item::do_brew_molecule () const
27 {
28   SCM style = get_elt_property ("style");
29   String st = gh_string_p (style) ?  ly_scm2string (style) : "";
30   SCM txt = get_elt_property ("text");
31   String t = gh_string_p (txt) ? ly_scm2string (txt) : "";
32
33   Molecule mol = paper_l ()->lookup_l(0)->text (st, t, paper_l ());
34
35   SCM s = get_elt_property ("word-space");
36   if (gh_number_p (s))
37     {
38       Molecule m;
39       m.set_empty (false);
40       mol.add_at_edge (X_AXIS, RIGHT, m, gh_scm2double (s)*
41                        staff_symbol_referencer (this).staff_space ());
42     }
43   return mol; 
44 }
45
46