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>
9 #include "all-font-metrics.hh"
10 #include "font-metric.hh"
11 #include "font-interface.hh"
13 #include "paper-def.hh"
17 /* todo: split up this func, reuse in text_item? */
19 Font_interface::get_default_font (Grob *me)
21 Font_metric *fm = unsmob_metrics (me->get_property ("font"));
24 fm = select_font (me->get_paper (), font_alist_chain (me));
25 me->set_property ("font", fm->self_scm ());
30 LY_DEFINE (ly_font_interface_get_default_font, "ly:get-default-font",
32 "Return the default font for grob @var{gr}.")
34 Grob *gr = unsmob_grob (grob);
35 SCM_ASSERT_TYPE (gr, grob, SCM_ARG1, __FUNCTION__, "grob");
37 return Font_interface::get_default_font (gr)->self_scm ();
41 Font_interface::font_alist_chain (Grob *g)
43 SCM defaults = g->get_paper ()->lookup_variable (ly_symbol2scm ("font-defaults"));
44 return g->get_property_alist_chain (defaults);
47 ADD_INTERFACE (Font_interface, "font-interface",
48 "Any symbol that is typeset through fixed sets of glyphs, "
50 "font-magnification font font-series font-shape "
51 "font-family font-name font-size");