lilypond-1.3.65
[lilypond.git] / lily / text-item.cc
blob777706f0bff1e0f9ae84995471be70aa3cd8d699
1 /*
2 text-item.cc -- implement Item
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 */
10 #include "debug.hh"
11 #include "molecule.hh"
12 #include "paper-def.hh"
13 #include "lookup.hh"
14 #include "staff-symbol-referencer.hh"
16 struct Text_item
18 static SCM brew_molecule (SCM);
22 MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Text_item,brew_molecule)
24 SCM
25 Text_item::brew_molecule (SCM sm)
27 Score_element * s = unsmob_element (sm);
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) : "";
34 Molecule mol = s->paper_l ()->lookup_l(0)->text (st, t, s->paper_l ());
36 SCM space = s->get_elt_property ("word-space");
37 if (gh_number_p (space))
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 ());
44 return mol.create_scheme ();