2 clef.cc -- implement Clef_item
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2004 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);
25 SCM glyph = s->get_property ("glyph-name");
27 if (scm_is_string (glyph))
29 String str = ly_scm2string (glyph);
31 if (to_boolean (s->get_property ("non-default"))
32 && s->break_status_dir () != RIGHT
33 && !to_boolean (s->get_property ("full-size-change")))
36 s->set_property ("glyph-name", scm_makfrom0str (str.to_str0 ()));
42 return SCM_UNSPECIFIED;
45 return SCM_UNSPECIFIED;
51 MAKE_SCHEME_CALLBACK (Clef,print,1)
53 Clef::print (SCM smob)
55 Grob *me = unsmob_grob (smob);
56 SCM glyph_scm = me->get_property ("glyph-name");
57 if (!scm_is_string (glyph_scm))
60 String glyph = String (ly_scm2string (glyph_scm));
61 Font_metric *fm = Font_interface::get_default_font (me);
62 Stencil out = fm->find_by_name (glyph);
65 me->warning (_f ("clef `%s' not found", glyph.to_str0 ()));
67 return out.smobbed_copy ();
71 ADD_INTERFACE (Clef, "clef-interface",
73 "non-default full-size-change glyph-name");