2 sustain-pedal.cc -- implement Sustain_pedal
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "molecule.hh"
11 #include "font-interface.hh"
14 // update comment --hwn
20 * symbols are at wrong place in font
26 glyph -- text string (TODO: make one large glyph of the Ped symbol, removes need for member_brew_molecule ())
33 DECLARE_SCHEME_CALLBACK (brew_molecule
, (SCM
));
37 MAKE_SCHEME_CALLBACK (Sustain_pedal
,brew_molecule
,1);
39 Sustain_pedal::brew_molecule (SCM smob
)
41 Grob
* e
= unsmob_grob (smob
);
44 SCM glyph
= e
->get_grob_property ("text");
45 if (!gh_string_p (glyph
))
46 return mol
.smobbed_copy ();
47 String text
= ly_scm2string (glyph
);
49 for (int i
= 0; i
< text
.length_i (); i
++)
51 String
idx ("pedal-");
52 if (text
.cut_str (i
, 3) == "Ped")
58 idx
+= String (&text
.byte_C ()[i
], 1);
59 Molecule m
= Font_interface::get_default_font (e
)->find_by_name (idx
);
61 mol
.add_at_edge (X_AXIS
, RIGHT
, m
, 0);
64 return mol
.smobbed_copy ();