]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/all-font-metrics.hh
e95f1c6f258a6514c3885d158467cc538d542606
[lilypond.git] / lily / include / all-font-metrics.hh
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 1998--2010 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 ALL_FONTS_HH
21 #define ALL_FONTS_HH
22
23 #include "file-path.hh"
24 #include "font-metric.hh"
25 #include "config.hh"
26
27 #if HAVE_PANGO_FT2
28 #include <pango/pango.h>
29 #include <pango/pangoft2.h>
30 #endif
31
32
33 /*
34    Interface to all fonts (both system fonts and fonts loaded
35    via Pango).
36 */
37 class All_font_metrics
38 {
39   Scheme_hash_table *otf_dict_;
40   File_path search_path_;
41
42 #if HAVE_PANGO_FT2
43   PangoFT2FontMap *pango_ft2_fontmap_;
44   Scheme_hash_table *pango_dict_;
45   int pango_dpi_;
46 #endif
47
48   map<string, Index_to_charcode_map > filename_charcode_maps_map_;
49   
50   All_font_metrics (All_font_metrics const &);
51 public:
52
53   Index_to_charcode_map const *get_index_to_charcode_map (string filename,
54                                                           int face_index,
55                                                           FT_Face face);
56
57   All_font_metrics (string search_path);
58   ~All_font_metrics ();
59
60   Pango_font *find_pango_font (PangoFontDescription const *description,
61                                Real scale);
62
63   Font_metric *find_font (string name);
64   Open_type_font *find_otf (string name);
65   SCM font_descriptions () const;
66 };
67
68 extern All_font_metrics *all_fonts_global;
69 SCM ly_reset_all_fonts ();
70
71 #endif /* ALL_FONTS_HH */