2 script.cc -- implement Script_interface
4 source file of the GNU LilyPond music typesetter
6 (c) 1999--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
12 #include "font-interface.hh"
13 #include "side-position-interface.hh"
14 #include "paper-def.hh"
16 #include "molecule.hh"
19 #include "note-column.hh"
22 Script_interface::get_molecule (Grob * me, Direction d)
24 SCM s = me->get_grob_property ("script-molecule");
25 assert (gh_pair_p (s));
28 if (key == ly_symbol2scm ("feta"))
30 return Font_interface::get_default_font (me)->find_by_name ("scripts-" +
31 ly_scm2string (index_cell (ly_cdr (s), d)));
33 else if (key == ly_symbol2scm ("accordion"))
35 return Lookup::accordion (ly_cdr (s), 1.0, Font_interface::get_default_font (me));
43 MAKE_SCHEME_CALLBACK (Script_interface,before_line_breaking,1);
45 Script_interface::before_line_breaking (SCM smob)
47 Grob * me = unsmob_grob (smob);
49 Direction d = Side_position_interface::get_direction (me);
54 we should not have `arbitrary' directions.
56 programming_error ("Script direction not yet known!");
60 Side_position_interface::set_direction (me,d);
62 if (Grob * par = me->get_parent (X_AXIS))
64 Grob * stem = Note_column::stem_l (par);
65 if (stem && Stem::first_head (stem))
67 me->set_parent (Stem::first_head (stem), X_AXIS);
71 return SCM_UNSPECIFIED;
75 MAKE_SCHEME_CALLBACK (Script_interface,brew_molecule,1);
78 Script_interface::brew_molecule (SCM smob)
80 Grob *me= unsmob_grob (smob);
82 Direction dir = Side_position_interface::get_direction (me);
85 programming_error ("Script direction not known, but molecule wanted.");
89 return get_molecule (me, dir).smobbed_copy ();
96 static bool has_interface (Grob*);
101 static bool has_interface (Grob*);
104 ADD_INTERFACE (Text_script,"text-script-interface",
108 ADD_INTERFACE (Script_interface, "script-interface",
110 "script-priority script-molecule staff-support");