2 clef.cc -- implement Clef_item
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
11 #include "font-interface.hh"
12 #include "international.hh"
14 #include "std-string.hh"
17 MAKE_SCHEME_CALLBACK (Clef
, calc_glyph_name
, 1);
19 Clef::calc_glyph_name (SCM smob
)
21 Item
*s
= unsmob_item (smob
);
22 SCM glyph
= s
->get_property ("glyph");
24 if (scm_is_string (glyph
))
26 string str
= ly_scm2string (glyph
);
28 if (to_boolean (s
->get_property ("non-default"))
29 && s
->break_status_dir () != RIGHT
30 && !to_boolean (s
->get_property ("full-size-change")))
35 return scm_makfrom0str (str
.c_str ());
39 return SCM_UNSPECIFIED
;
42 MAKE_SCHEME_CALLBACK (Clef
, print
, 1)
44 Clef::print (SCM smob
)
46 Grob
*me
= unsmob_grob (smob
);
47 SCM glyph_scm
= me
->get_property ("glyph-name");
48 if (!scm_is_string (glyph_scm
))
51 string glyph
= string (ly_scm2string (glyph_scm
));
52 Font_metric
*fm
= Font_interface::get_default_font (me
);
53 Stencil out
= fm
->find_by_name (glyph
);
55 me
->warning (_f ("clef `%s' not found", glyph
.c_str ()));
56 return out
.smobbed_copy ();
59 ADD_INTERFACE (Clef
, "clef-interface",