]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/open-type-font.hh
Issue 5024: Rework the Preinit framework into something simpler
[lilypond.git] / lily / include / open-type-font.hh
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2004--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
5
6   LilyPond is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10
11   LilyPond is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef OPEN_TYPE_FONT_HH
21 #define OPEN_TYPE_FONT_HH
22
23 #include "font-metric.hh"
24
25 Index_to_charcode_map make_index_to_charcode_map (FT_Face face);
26 void get_unicode_name (char *s, FT_ULong code);
27 void get_glyph_index_name (char *s, FT_ULong code);
28
29 struct Preinit_Open_type_font {
30   SCM lily_subfonts_;
31   SCM lily_character_table_;
32   SCM lily_global_table_;
33   SCM lily_index_to_bbox_table_;
34   Preinit_Open_type_font ();
35 };
36
37 class Open_type_font : Preinit_Open_type_font, public Font_metric
38 {
39   /* handle to face object */
40   FT_Face face_;
41   string postscript_name_;
42
43   Index_to_charcode_map index_to_charcode_map_;
44   Open_type_font (FT_Face);
45
46   DECLARE_CLASSNAME (Open_type_font);
47 public:
48   Real get_units_per_EM () const;
49   SCM get_subfonts () const;
50   SCM get_global_table () const;
51   SCM get_char_table () const;
52   SCM glyph_list () const;
53   SCM get_glyph_outline (size_t signed_idx) const;
54   Box get_glyph_outline_bbox (size_t signed_idx) const;
55   string get_otf_table (const string &tag) const;
56   static SCM make_otf (const string&);
57   string font_name () const;
58   ~Open_type_font ();
59   Offset attachment_point (const string&) const;
60   size_t count () const;
61   Box get_indexed_char_dimensions (size_t) const;
62   Box get_unscaled_indexed_char_dimensions (size_t) const;
63   size_t name_to_index (string) const;
64   size_t index_to_charcode (size_t) const;
65   void derived_mark () const;
66   SCM sub_fonts () const;
67   Real design_size () const;
68 };
69
70 string get_otf_table (FT_Face face, const string &tag);
71 FT_Face open_ft_face (const string&, FT_Long idx);
72 string get_postscript_name (FT_Face face);
73
74 #endif /* OPEN_TYPE_FONT_HH */