2 clef.cc -- implement Clef_item
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
14 #include "font-interface.hh"
16 MAKE_SCHEME_CALLBACK (Clef, calc_glyph_name, 1);
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")))
34 return scm_makfrom0str (str.to_str0 ());
38 return SCM_UNSPECIFIED;
41 MAKE_SCHEME_CALLBACK (Clef, print, 1)
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))
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);
54 me->warning (_f ("clef `%s' not found", glyph.to_str0 ()));
55 return out.smobbed_copy ();
58 ADD_INTERFACE (Clef, "clef-interface",