]> git.donarmstrong.com Git - lilypond.git/blob - lily/open-type-font-scheme.cc
* flower
[lilypond.git] / lily / open-type-font-scheme.cc
1 /*
2   open-type-font.cc -- implement Open_type_font
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2004--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #include "modified-font-metric.hh"
10 #include "open-type-font.hh"
11
12 LY_DEFINE (ly_font_sub_fonts, "ly:font-sub-fonts", 1, 0, 0,
13            (SCM font),
14            "Given the font metric @var{font} of an OpenType font, return the "
15            "names of the subfonts within @var{font}.")
16 {
17   Font_metric *fm = unsmob_metrics (font);
18   SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
19   return fm->sub_fonts ();
20 }
21
22 LY_DEFINE (ly_otf_font_glyph_info, "ly:otf-font-glyph-info", 2, 0, 0,
23            (SCM font, SCM glyph),
24            "Given the font metric @var{font} of an OpenType font, return the "
25            "information about named glyph @var{glyph} (a string)")
26 {
27   Modified_font_metric *fm
28     = dynamic_cast<Modified_font_metric *> (unsmob_metrics (font));
29   Open_type_font *otf = dynamic_cast<Open_type_font *> (fm->original_font ());
30   SCM_ASSERT_TYPE (otf, font, SCM_ARG1, __FUNCTION__, "OTF font-metric");
31   SCM_ASSERT_TYPE (scm_is_string (glyph), glyph, SCM_ARG1,
32                    __FUNCTION__, "string");
33
34   SCM sym = scm_string_to_symbol (glyph);
35   return scm_hashq_ref (otf->get_char_table (), sym, SCM_EOL);
36 }