]> git.donarmstrong.com Git - lilypond.git/blob - lily/clef.cc
* lily/parser.yy (My_lily_parser): uncomment code. (Causes
[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--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "clef.hh"
10 #include "string.hh"
11 #include "molecule.hh"
12 #include "item.hh"
13 #include "font-interface.hh"
14
15 /*
16  FIXME: should use symbol for #'style.
17 */
18 MAKE_SCHEME_CALLBACK (Clef,before_line_breaking,1);
19 SCM
20 Clef::before_line_breaking (SCM smob)
21 {
22   Item * s = unsmob_item (smob);
23
24   SCM glyph = s->get_grob_property ("glyph-name");
25   
26   if (gh_string_p (glyph))
27     {
28       String str = ly_scm2string (glyph);
29
30       if (to_boolean (s->get_grob_property ("non-default"))
31           && s->break_status_dir () != RIGHT
32           && !to_boolean (s->get_grob_property ("full-size-change")))
33         {
34           str += "_change";
35           s->set_grob_property ("glyph-name", ly_str02scm (str.ch_C ()));         
36         }
37     }
38   else
39     {
40       s->suicide ();
41       return SCM_UNSPECIFIED;
42     }
43
44   return SCM_UNSPECIFIED;
45 }
46
47
48
49
50 MAKE_SCHEME_CALLBACK (Clef,brew_molecule,1)
51 SCM
52 Clef::brew_molecule (SCM smob) 
53 {
54   Grob * sc = unsmob_grob (smob);
55   SCM glyph = sc->get_grob_property ("glyph-name");
56   if (gh_string_p (glyph))
57     {
58       return Font_interface::get_default_font (sc)->find_by_name (String (ly_scm2string (glyph))).smobbed_copy ();
59     }
60   else
61     {
62       return SCM_EOL;
63     }
64 }
65
66
67 ADD_INTERFACE (Clef, "clef-interface",
68   "A clef sign",
69   "non-default full-size-change glyph-name");
70