]> git.donarmstrong.com Git - lilypond.git/blob - lily/text-item.cc
release: 1.3.62
[lilypond.git] / lily / text-item.cc
1 /*   
2   text-item.cc -- implement 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 "debug.hh"
11 #include "molecule.hh"
12 #include "paper-def.hh"
13 #include "lookup.hh"
14 #include "staff-symbol-referencer.hh"
15
16 struct Text_item
17 {
18   static SCM brew_molecule (SCM);
19 };
20
21
22 MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Text_item,brew_molecule)
23
24 SCM 
25 Text_item::brew_molecule (SCM sm) 
26 {
27   Score_element * s = unsmob_element (sm);
28   
29   SCM style = s->get_elt_property ("style");
30   String st = gh_string_p (style) ?  ly_scm2string (style) : "";
31   SCM txt = s-> get_elt_property ("text");
32   String t = gh_string_p (txt) ? ly_scm2string (txt) : "";
33
34   Molecule mol =  s->paper_l ()->lookup_l(0)->text (st, t, s->paper_l ());
35
36   SCM space =  s->get_elt_property ("word-space");
37   if (gh_number_p (space))
38     {
39       Molecule m;
40       m.set_empty (false);
41       mol.add_at_edge (X_AXIS, RIGHT, m, gh_scm2double (space)*
42                        staff_symbol_referencer  (s).staff_space ());
43     }
44   return mol.create_scheme (); 
45 }
46
47