* lexer-gcc-3.1.sh: Remove.
[lilypond/patrick.git] / lily / clef.cc
blob0718f8bd536ac9c2c1c0e3ce59e307284b8faa7e
1 /*
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>
7 */
9 #include "clef.hh"
11 #include "font-interface.hh"
12 #include "international.hh"
13 #include "item.hh"
14 #include "std-string.hh"
15 #include "stencil.hh"
17 MAKE_SCHEME_CALLBACK (Clef, calc_glyph_name, 1);
18 SCM
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")))
32 str += "_change";
35 return scm_makfrom0str (str.c_str ());
38 s->suicide ();
39 return SCM_UNSPECIFIED;
42 MAKE_SCHEME_CALLBACK (Clef, print, 1)
43 SCM
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))
49 return SCM_EOL;
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);
54 if (out.is_empty ())
55 me->warning (_f ("clef `%s' not found", glyph.c_str ()));
56 return out.smobbed_copy ();
59 ADD_INTERFACE (Clef, "clef-interface",
60 "A clef sign",
62 /* properties */
63 "full-size-change "
64 "glyph "
65 "glyph-name "
66 "non-default "