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"
17 FIXME: should use symbol for #'style.
19 MAKE_SCHEME_CALLBACK (Clef, before_line_breaking, 1);
21 Clef::before_line_breaking (SCM smob)
23 Item *s = unsmob_item (smob);
24 SCM glyph = s->get_property ("glyph-name");
26 if (!scm_is_string (glyph))
30 String str = ly_scm2string (glyph);
32 if (to_boolean (s->get_property ("non-default"))
33 && s->break_status_dir () != RIGHT
34 && !to_boolean (s->get_property ("full-size-change")))
37 s->set_property ("glyph-name", scm_makfrom0str (str.to_str0 ()));
41 return SCM_UNSPECIFIED;
44 MAKE_SCHEME_CALLBACK (Clef, print, 1)
46 Clef::print (SCM smob)
48 Grob *me = unsmob_grob (smob);
49 SCM glyph_scm = me->get_property ("glyph-name");
50 if (!scm_is_string (glyph_scm))
53 String glyph = String (ly_scm2string (glyph_scm));
54 Font_metric *fm = Font_interface::get_default_font (me);
55 Stencil out = fm->find_by_name (glyph);
57 me->warning (_f ("clef `%s' not found", glyph.to_str0 ()));
58 return out.smobbed_copy ();
61 ADD_INTERFACE (Clef, "clef-interface",
63 "non-default full-size-change glyph-name");