]> git.donarmstrong.com Git - lilypond.git/blob - lily/clef.cc
* configure.in: Test for and accept lmodern if EC fonts not found.
[lilypond.git] / lily / clef.cc
1 /*
2   clef.cc -- implement Clef_item
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "clef.hh"
10
11 #include "string.hh"
12 #include "stencil.hh"
13 #include "item.hh"
14 #include "font-interface.hh"
15
16 /*
17  FIXME: should use symbol for #'style.
18 */
19 MAKE_SCHEME_CALLBACK (Clef,before_line_breaking,1);
20 SCM
21 Clef::before_line_breaking (SCM smob)
22 {
23   Item *s = unsmob_item (smob);
24
25   SCM glyph = s->get_property ("glyph-name");
26   
27   if (scm_is_string (glyph))
28     {
29       String str = ly_scm2string (glyph);
30
31       if (to_boolean (s->get_property ("non-default"))
32           && s->break_status_dir () != RIGHT
33           && !to_boolean (s->get_property ("full-size-change")))
34         {
35           str += "_change";
36           s->set_property ("glyph-name", scm_makfrom0str (str.to_str0 ()));       
37         }
38     }
39   else
40     {
41       s->suicide ();
42       return SCM_UNSPECIFIED;
43     }
44
45   return SCM_UNSPECIFIED;
46 }
47
48
49
50
51 MAKE_SCHEME_CALLBACK (Clef,print,1)
52 SCM
53 Clef::print (SCM smob) 
54 {
55   Grob *me = unsmob_grob (smob);
56   SCM glyph_scm = me->get_property ("glyph-name");
57   if (!scm_is_string (glyph_scm))
58     return SCM_EOL;
59
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);
63   if (out.is_empty ())
64     {
65       me->warning (_f ("clef `%s' not found", glyph.to_str0 ()));
66     }
67   return out.smobbed_copy ();
68 }
69
70
71 ADD_INTERFACE (Clef, "clef-interface",
72   "A clef sign",
73   "non-default full-size-change glyph-name");
74