]> git.donarmstrong.com Git - lilypond.git/blob - lily/all-font-metrics-scheme.cc
5ddc156b11c63716a0a1ee5d19923c129c2e5090
[lilypond.git] / lily / all-font-metrics-scheme.cc
1 /* 
2   all-font-metrics-scheme.cc -- implement bindings for
3   All_font_metrics.
4   
5   source file of the GNU LilyPond music typesetter
6   
7   (c) 2007 Han-Wen Nienhuys <hanwen@lilypond.org>
8   
9 */
10
11 #include "all-font-metrics.hh"
12 #include "main.hh"
13
14 LY_DEFINE (ly_reset_all_fonts, "ly:reset-all-fonts", 0, 0, 0,
15            (),
16            "Forget all about previously loaded fonts.")
17 {
18   delete all_fonts_global;
19   all_fonts_global = new All_font_metrics (global_path.to_string ());
20
21   return SCM_UNSPECIFIED;
22 }
23
24
25 LY_DEFINE (ly_system_font_load, "ly:system-font-load", 1, 0, 0,
26            (SCM name),
27            "Load the OpenType system font @file{@var{name}.otf}."
28            "  Fonts loaded with this command must contain three"
29            " additional SFNT font tables called @code{LILC},"
30            " @code{LILF}, and @code{LILY}, needed for typesetting"
31            " musical elements.  Currently, only the Emmentaler and"
32            " the Aybabtu fonts fulfill these requirements.\n"
33            "\n"
34            "Note that only @code{ly:font-get-glyph} and derived"
35            " code (like @code{\\lookup}) can access glyphs from"
36            " the system fonts; text strings are handled exclusively"
37            " via the Pango interface.")
38 {
39   LY_ASSERT_TYPE (scm_is_string, name, 1);
40   
41   string name_str = ly_scm2string (name);
42   Font_metric *fm = all_fonts_global->find_font (name_str);
43
44   return fm->self_scm ();
45 }