Use scalar instead of embedded_scm for context mod overrides.
[lilypond/mpolesky.git] / lily / clef.cc
blob80e480751d66ea44ee87a9d9f5e6776c6b78f140
1 /*
2 clef.cc -- implement Clef_item
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
9 #include "clef.hh"
11 #include "font-interface.hh"
12 #include "international.hh"
13 #include "item.hh"
14 #include "stencil.hh"
16 MAKE_SCHEME_CALLBACK (Clef, calc_glyph_name, 1);
17 SCM
18 Clef::calc_glyph_name (SCM smob)
20 Item *s = unsmob_item (smob);
21 SCM glyph = s->get_property ("glyph");
23 if (scm_is_string (glyph))
25 string str = ly_scm2string (glyph);
27 if (to_boolean (s->get_property ("non-default"))
28 && s->break_status_dir () != RIGHT
29 && !to_boolean (s->get_property ("full-size-change")))
31 str += "_change";
34 return ly_string2scm (str);
37 s->suicide ();
38 return SCM_UNSPECIFIED;
41 MAKE_SCHEME_CALLBACK (Clef, print, 1)
42 SCM
43 Clef::print (SCM smob)
45 Grob *me = unsmob_grob (smob);
46 SCM glyph_scm = me->get_property ("glyph-name");
47 if (!scm_is_string (glyph_scm))
48 return SCM_EOL;
50 string glyph = string (ly_scm2string (glyph_scm));
51 Font_metric *fm = Font_interface::get_default_font (me);
52 Stencil out = fm->find_by_name (glyph);
53 if (out.is_empty ())
54 me->warning (_f ("clef `%s' not found", glyph.c_str ()));
55 return out.smobbed_copy ();
58 ADD_INTERFACE (Clef,
59 "A clef sign.",
61 /* properties */
62 "full-size-change "
63 "glyph "
64 "glyph-name "
65 "non-default "