lilypond-1.3.130
[lilypond.git] / lily / script.cc
blobc680f73d9306061e5b64929eaa4c0bf71a765156
1 /*
2 script.cc -- implement Script
4 source file of the GNU LilyPond music typesetter
6 (c) 1999--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 */
10 #include "debug.hh"
11 #include "script.hh"
12 #include "font-interface.hh"
13 #include "side-position-interface.hh"
14 #include "paper-def.hh"
15 #include "item.hh"
16 #include "molecule.hh"
17 #include "lookup.hh"
19 Molecule
20 Script::get_molecule(Grob * me, Direction d)
22 SCM s = me->get_grob_property ("molecule");
23 assert (gh_pair_p (s));
25 SCM key = gh_car (s);
26 if (key == ly_symbol2scm ("feta"))
28 return Font_interface::get_default_font (me)->find_by_name ("scripts-" +
29 ly_scm2string (index_cell (gh_cdr (s), d)));
31 else if (key == ly_symbol2scm ("accordion"))
33 return Lookup::accordion (gh_cdr (s), 1.0, Font_interface::get_default_font (me));
35 else
36 assert (false);
38 return Molecule ();
41 MAKE_SCHEME_CALLBACK(Script,after_line_breaking,1);
42 SCM
43 Script::after_line_breaking (SCM smob)
45 Grob * me = unsmob_grob (smob);
47 Direction d = Side_position::get_direction (me);
48 Side_position::set_direction (me,d);
50 return SCM_UNSPECIFIED;
53 MAKE_SCHEME_CALLBACK(Script,brew_molecule,1);
55 SCM
56 Script::brew_molecule (SCM smob)
58 Grob *me= unsmob_grob (smob);
59 #if 0
60 Direction dir = DOWN;
61 SCM d = me->get_grob_property ("direction");
62 if (isdir_b (d))
63 dir = to_dir (d);
64 #endif
65 Direction dir = Side_position::get_direction(me);
66 return get_molecule (me, dir).smobbed_copy();
69 bool
70 Script::has_interface (Grob*me)
72 return me->has_interface (ly_symbol2scm ("script-interface"));
75 void
76 Script::set_interface (Grob*me)
78 return me->set_interface (ly_symbol2scm ("script-interface"));