2 script.cc -- implement Script_interface
4 source file of the GNU LilyPond music typesetter
6 (c) 1999--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "directional-element-interface.hh"
13 #include "font-interface.hh"
14 #include "side-position-interface.hh"
15 #include "paper-def.hh"
17 #include "molecule.hh"
20 #include "note-column.hh"
23 Script_interface::get_molecule (Grob * me, Direction d)
25 SCM s = me->get_grob_property ("script-molecule");
26 assert (gh_pair_p (s));
29 if (key == ly_symbol2scm ("feta"))
31 SCM name_entry = ly_cdr (s);
33 SCM str = (gh_pair_p (name_entry)) ? index_get_cell (name_entry, d) : name_entry;
34 return Font_interface::get_default_font (me)->find_by_name ("scripts-" +
37 else if (key == ly_symbol2scm ("accordion"))
39 return Lookup::accordion (ly_cdr (s), 1.0, Font_interface::get_default_font (me));
47 MAKE_SCHEME_CALLBACK (Script_interface,before_line_breaking,1);
49 Script_interface::before_line_breaking (SCM smob)
51 Grob * me = unsmob_grob (smob);
53 Direction d = Side_position_interface::get_direction (me);
58 we should not have `arbitrary' directions.
60 programming_error ("Script direction not yet known!");
64 set_grob_direction (me, d);
66 if (Grob * par = me->get_parent (X_AXIS))
68 Grob * stem = Note_column::get_stem (par);
69 if (stem && Stem::first_head (stem))
71 me->set_parent (Stem::first_head (stem), X_AXIS);
75 return SCM_UNSPECIFIED;
79 MAKE_SCHEME_CALLBACK (Script_interface,brew_molecule,1);
82 Script_interface::brew_molecule (SCM smob)
84 Grob *me= unsmob_grob (smob);
86 Direction dir = Side_position_interface::get_direction (me);
89 programming_error ("Script direction not known, but molecule wanted.");
93 return get_molecule (me, dir).smobbed_copy ();
100 static bool has_interface (Grob*);
105 static bool has_interface (Grob*);
108 ADD_INTERFACE (Text_script,"text-script-interface",
112 ADD_INTERFACE (Script_interface, "script-interface",
114 "script-priority script-molecule");