2 clef.cc -- implement Clef_item
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
11 #include "font-interface.hh"
12 #include "international.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 ly_string2scm (str
);
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
.c_str ()));
55 return out
.smobbed_copy ();