]> git.donarmstrong.com Git - lilypond.git/blob - lily/all-font-metrics-scheme.cc
Web-ja: update introduction
[lilypond.git] / lily / all-font-metrics-scheme.cc
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2007--2015 Han-Wen Nienhuys <hanwen@lilypond.org>
5
6
7   LilyPond is free software: you can redistribute it and/or modify
8   it under the terms of the GNU General Public License as published by
9   the Free Software Foundation, either version 3 of the License, or
10   (at your option) any later version.
11
12   LilyPond is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   GNU General Public License for more details.
16
17   You should have received a copy of the GNU General Public License
18   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #include "all-font-metrics.hh"
22 #include "main.hh"
23 #include "protected-scm.hh"
24
25 All_font_metrics *all_fonts_global = 0;
26 Protected_scm all_fonts_global_scm;
27
28 LY_DEFINE (ly_reset_all_fonts, "ly:reset-all-fonts", 0, 0, 0,
29            (),
30            "Forget all about previously loaded fonts.")
31 {
32   all_fonts_global = new All_font_metrics (global_path.to_string ());
33   all_fonts_global_scm = all_fonts_global->unprotect ();
34
35   return SCM_UNSPECIFIED;
36 }
37
38 LY_DEFINE (ly_system_font_load, "ly:system-font-load", 1, 0, 0,
39            (SCM name),
40            "Load the OpenType system font @file{@var{name}.otf}."
41            "  Fonts loaded with this command must contain three"
42            " additional SFNT font tables called @code{LILC},"
43            " @code{LILF}, and @code{LILY}, needed for typesetting"
44            " musical elements.  Currently, only the Emmentaler and"
45            " the Emmentaler-Brace fonts fulfill these requirements.\n"
46            "\n"
47            "Note that only @code{ly:font-get-glyph} and derived"
48            " code (like @code{\\lookup}) can access glyphs from"
49            " the system fonts; text strings are handled exclusively"
50            " via the Pango interface.")
51 {
52   LY_ASSERT_TYPE (scm_is_string, name, 1);
53
54   string name_str = ly_scm2string (name);
55   Font_metric *fm = all_fonts_global->find_font (name_str);
56
57   return fm->self_scm ();
58 }