* scm/beam.scm (check-slope-callbacks): check sign of slope.
[lilypond.git] / lily / font-interface.cc
blob31ddd6bc6d654228476c66544b2649b4f908ff27
1 /*
2 font-interface.cc -- implement Font_interface
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
9 #include "all-font-metrics.hh"
10 #include "font-metric.hh"
11 #include "font-interface.hh"
12 #include "grob.hh"
13 #include "output-def.hh"
14 #include "warn.hh"
17 /* todo: split up this func, reuse in text_item? */
18 Font_metric *
19 Font_interface::get_default_font (Grob *me)
21 Font_metric *fm = unsmob_metrics (me->get_property ("font"));
22 if (!fm)
24 SCM defaults
25 = me->get_paper ()->lookup_variable (ly_symbol2scm ("font-defaults"));
26 SCM chain = me->get_property_alist_chain (defaults);
28 fm = select_font (me->get_paper (), chain);
29 me->set_property ("font", fm->self_scm ());
32 return fm;
35 LY_DEFINE (ly_font_interface_get_default_font, "ly:get-default-font",
36 1 , 0, 0, (SCM grob),
37 "Return the default font for grob @var{gr}.")
39 Grob *gr = unsmob_grob (grob);
40 SCM_ASSERT_TYPE (gr, grob, SCM_ARG1, __FUNCTION__, "grob");
42 return Font_interface::get_default_font (gr)->self_scm ();
46 SCM
47 Font_interface::text_font_alist_chain (Grob *g)
49 SCM defaults
50 = g->get_paper ()->lookup_variable (ly_symbol2scm ("text-font-defaults"));
51 return g->get_property_alist_chain (defaults);
54 ADD_INTERFACE (Font_interface, "font-interface",
55 "Any symbol that is typeset through fixed sets of glyphs, "
56 " (ie. fonts)",
57 "font-magnification font font-series font-shape "
58 "font-family font-encoding font-name font-size");