source file of the GNU LilyPond music typesetter
- (c) 2000--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 2000--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
/*
Ugh: why the defaults?
*/
- SCM defaults = ly_cdr (scm_assoc (ly_symbol2scm ("font-defaults"),
- me->get_paper ()->style_sheet_));
+ SCM defaults = me->get_paper ()->lookup_variable (ly_symbol2scm ("font-defaults"));
SCM ch = me->get_property_alist_chain (defaults);
-
return ch;
}
+
+MAKE_SCHEME_CALLBACK(Font_interface, get_property_alist_chain, 1);
+SCM
+Font_interface::get_property_alist_chain (SCM grob)
+{
+ Grob * g = unsmob_grob (grob);
+ SCM_ASSERT_TYPE(g, grob, SCM_ARG1, __FUNCTION__, "grob");
+ return font_alist_chain (g);
+}
+
/*
todo: split up this func, reuse in text_item?
*/
LY_DEFINE(ly_font_interface_get_default_font,
- "ly-get-default-font", 1 , 0, 0,
+ "ly:get-default-font", 1 , 0, 0,
(SCM grob), "Return the default font for grob @var{gr}.")
{
Grob * gr = unsmob_grob (grob);
return Font_interface::get_default_font (gr)->self_scm ();
}
-LY_DEFINE(ly_font_interface_get_font,"ly-get-font", 2, 0, 0,
- (SCM grob, SCM alist),
- "Return a font metric satisfying the font-qualifiers in @var{alist}.
-
-
-The font object represents the metric information of a font. Every font
-that is loaded into LilyPond can be accessed via Scheme.
-
-LilyPond only needs to know the dimension of glyph to be able to process
-them. This information is stored in font metric files. LilyPond can read
-two types of font-metrics: @TeX{} Font Metric files (TFM files) and
-Adobe Font Metric files (AFM files). LilyPond will always try to load
-AFM files first since they are more versatile.
-
-")
+LY_DEFINE(ly_font_interface_get_font,"ly:get-font", 2, 0, 0,
+ (SCM grob, SCM chain),
+ "Return a font metric satisfying the font-qualifiers in the alist chain @var{chain}.\n"
+"\n"
+"The font object represents the metric information of a font. Every font\n"
+"that is loaded into LilyPond can be accessed via Scheme. \n"
+"\n"
+"LilyPond only needs to know the dimension of glyph to be able to process\n"
+"them. This information is stored in font metric files. LilyPond can read\n"
+"two types of font-metrics: @TeX{} Font Metric files (TFM files) and\n"
+"Adobe Font Metric files (AFM files). LilyPond will always try to load\n"
+"AFM files first since they are more versatile.\n"
+"\n"
+"An alist chain is a list of alists.\n")
{
Grob * gr = unsmob_grob (grob);
SCM_ASSERT_TYPE(gr, grob, SCM_ARG1, __FUNCTION__, "grob");
- Font_metric*fm=
- Font_interface::get_font (gr, gh_cons (alist,
- Font_interface::font_alist_chain (gr)));
-
+ Font_metric*fm = Font_interface::get_font (gr, chain);
return fm->self_scm();
}
-
Font_metric *
Font_interface::get_font (Grob *me, SCM chain)
{
if (!gh_string_p (name))
{
- SCM ss = me->get_paper ()->style_sheet_;
+ Paper_def * p = me->get_paper ();
- SCM proc = ly_cdr (scm_assoc (ly_symbol2scm ("properties-to-font"),
- ss));
-
- SCM fonts = ly_cdr (scm_assoc (ly_symbol2scm ("fonts"), ss));
+ SCM proc = p->lookup_variable (ly_symbol2scm ("properties-to-font"));
+ SCM fonts = p->lookup_variable (ly_symbol2scm ("fonts"));
assert (gh_procedure_p (proc));
name = gh_call2 (proc, fonts, chain);
}
- SCM mag = me->get_grob_property ("font-magnification");
- Real rmag = gh_number_p (mag) ? gh_scm2double (mag) : 1.0;
+ SCM mag = ly_assoc_chain (ly_symbol2scm ("font-magnification"), chain);
+
+ Real rmag = gh_pair_p (mag) && gh_number_p (gh_cdr (mag))
+ ? gh_scm2double (gh_cdr (mag)) : 1.0;
Font_metric *fm = me->get_paper ()->find_font (name, rmag);
return fm;
Font_interface::add_style (Grob* me, SCM style, SCM chain)
{
assert (gh_symbol_p (style));
-
- SCM sheet = me->get_paper ()->style_sheet_;
- SCM style_alist = ly_cdr (scm_assoc (ly_symbol2scm ("style-alist"), sheet));
+ SCM style_alist = me->get_paper ()->lookup_variable (ly_symbol2scm ("style-alist"));
SCM entry = scm_assoc (style, style_alist);
if (gh_pair_p (entry))
{