Fix InstrumentSwitch grob definition.
[lilypond.git] / lily / font-interface.cc
blob16f51c82b344422fcfb2caec317c03e1627690d3
1 /*
2 font-interface.cc -- implement Font_interface
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
9 #include "font-interface.hh"
11 #include "all-font-metrics.hh"
12 #include "output-def.hh"
13 #include "warn.hh"
14 #include "grob.hh"
16 /* todo: split up this func, reuse in text_item? */
17 Font_metric *
18 Font_interface::get_default_font (Grob *me)
20 Font_metric *fm = unsmob_metrics (me->get_property ("font"));
21 if (!fm)
23 SCM chain = music_font_alist_chain (me);
25 fm = select_font (me->layout (), chain);
26 me->set_property ("font", fm->self_scm ());
29 return fm;
32 SCM
33 Font_interface::music_font_alist_chain (Grob *g)
35 SCM defaults
36 = g->layout ()->lookup_variable (ly_symbol2scm ("font-defaults"));
37 if (defaults == SCM_UNDEFINED)
38 defaults = SCM_EOL;
39 return g->get_property_alist_chain (defaults);
42 SCM
43 Font_interface::text_font_alist_chain (Grob *g)
45 SCM defaults
46 = g->layout ()->lookup_variable (ly_symbol2scm ("text-font-defaults"));
47 if (defaults == SCM_UNDEFINED)
48 defaults = SCM_EOL;
49 return g->get_property_alist_chain (defaults);
52 ADD_INTERFACE (Font_interface,
53 "Any symbol that is typeset through fixed sets of glyphs,"
54 " (i.e., fonts).",
56 /* properties */
57 "font "
58 "font-encoding "
59 "font-family "
60 "font-name "
61 "font-series "
62 "font-shape "
63 "font-size "