2 sustain-pedal.cc -- implement Sustain_pedal
4 source file of the GNU LilyPond music typesetter
6 (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "sustain-pedal.hh"
11 #include "side-position-interface.hh"
12 #include "molecule.hh"
14 #include "staff-symbol-referencer.hh"
17 Sustain_pedal::after_line_breaking ()
20 UGH. Should work automatically via offset callback.
22 Side_position_interface i (this);
23 Direction d = i.get_direction ();
28 Sustain_pedal::do_brew_molecule () const
31 SCM glyph = get_elt_property ("text");
32 if (glyph == SCM_UNDEFINED)
34 String text = ly_scm2string (glyph);
36 for (int i = 0; i < text.length_i (); i++)
38 String idx = String ("pedal-") + String (&text.byte_C ()[i], 1);
39 Molecule m = lookup_l ()->afm_find (idx);
45 SCM s = scm_eval (gh_list (ly_symbol2scm ("pedal-kerning"),
46 ly_str02scm (String (&text.byte_C ()[i - 1], 1).ch_C ()),
47 ly_str02scm (String (&text.byte_C ()[i], 1).ch_C ()),
51 Staff_symbol_referencer_interface st (this);
52 Real staff_space = st.staff_space ();
53 kern = gh_scm2double (s) * staff_space;
56 mol.add_at_edge (X_AXIS, RIGHT, m, kern);
64 Sustain_pedal ::Sustain_pedal(SCM s )