2 font-interface.cc -- implement Font_interface
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "all-font-metrics.hh"
11 #include "font-metric.hh"
12 #include "font-interface.hh"
14 #include "paper-def.hh"
19 todo: split up this func, reuse in text_item?
22 Font_interface::get_default_font (Grob
*me
)
24 Font_metric
* fm
= unsmob_metrics (me
->get_grob_property ("font"));
28 fm
= select_font (me
->get_paper (), font_alist_chain (me
));
29 me
->set_grob_property ("font", fm
->self_scm ());
34 LY_DEFINE(ly_font_interface_get_default_font
,
35 "ly:get-default-font", 1 , 0, 0,
36 (SCM grob
), "Return the default font for grob @var{gr}.")
38 Grob
* gr
= unsmob_grob (grob
);
39 SCM_ASSERT_TYPE(gr
, grob
, SCM_ARG1
, __FUNCTION__
, "grob");
41 return Font_interface::get_default_font (gr
)->self_scm ();
46 Font_interface::font_alist_chain (Grob
*g
)
48 SCM defaults
= g
->get_paper ()->lookup_variable (ly_symbol2scm ("font-defaults"));
50 return g
->get_property_alist_chain (defaults
);
57 ADD_INTERFACE (Font_interface
, "font-interface",
58 "Any symbol that is typeset through fixed sets of glyphs (ie. fonts)",
59 "font-magnification font font-series font-shape font-family font-name font-design-size font-relative-size");