Use scalar instead of embedded_scm for context mod overrides.
[lilypond/mpolesky.git] / lily / sustain-pedal.cc
blob4e2a8f529ca669d42e2b910a35b67a83e143ebd1
1 /*
2 sustain-pedal.cc -- implement Sustain_pedal
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8 #include "grob.hh"
9 #include "stencil.hh"
10 #include "font-interface.hh"
12 // update comment --hwn
14 Urg.
15 This is almost text
16 Problem is:
17 * we have no kerning
18 * symbols are at wrong place in font
22 Properties:
24 glyph -- text string (TODO: make one large glyph of the Ped symbol, removes need for member_print ())
28 FIXME. Need to use markup.
30 struct Sustain_pedal
32 public:
33 DECLARE_SCHEME_CALLBACK (print, (SCM));
36 MAKE_SCHEME_CALLBACK (Sustain_pedal, print, 1);
37 SCM
38 Sustain_pedal::print (SCM smob)
40 Grob *e = unsmob_grob (smob);
42 Stencil mol;
43 SCM glyph = e->get_property ("text");
44 if (!scm_is_string (glyph))
45 return mol.smobbed_copy ();
47 string text = ly_scm2string (glyph);
49 for (ssize i = 0; i < text.length (); i++)
51 string idx ("pedal.");
52 if (text.substr (i, 3) == "Ped")
54 idx += "Ped";
55 i += 2;
57 else
58 idx += string (&text.c_str ()[i], 1);
59 Stencil m = Font_interface::get_default_font (e)->find_by_name (idx);
60 if (!m.is_empty ())
61 mol.add_at_edge (X_AXIS, RIGHT, m, 0);
64 return mol.smobbed_copy ();