]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/afm.hh
80d2917236b94c4f6aa0cad6d471f3afb78139d5
[lilypond.git] / lily / include / afm.hh
1 /*
2   afm.hh -- declare Adobe_font_metric
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1998--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #ifndef AFM_HH
10 #define AFM_HH
11
12 #include <map>
13 using namespace std;
14
15 #include "array.hh"
16 #include "font-metric.hh"
17 #include "parse-afm.hh"
18
19 class Adobe_font_metric : public Simple_font_metric
20 {
21   DECLARE_CLASSNAME(Adobe_font_metric);
22 public:
23   AFM_Font_info *font_info_;
24   unsigned int checksum_;
25   Real design_size_;
26
27   ~Adobe_font_metric ();
28
29   virtual int name_to_index (String) const;
30   virtual int count () const;
31   virtual int index_to_ascii (int) const;
32   virtual Box get_ascii_char (int) const;
33   virtual Box get_indexed_char (int) const;
34   virtual Offset get_indexed_wxwy (int) const;
35   static SCM make_afm (AFM_Font_info *, unsigned, Real);
36   virtual Real design_size () const;
37   virtual String font_name () const;
38
39 protected:
40   AFM_CharMetricInfo const *find_char_metric (String name) const;
41   AFM_CharMetricInfo const *find_ascii_metric (int) const;
42
43   Array<int> ascii_to_metric_idx_;
44   map<String, int> name_to_metric_dict_;
45
46   Adobe_font_metric (AFM_Font_info *);
47 };
48
49 SCM read_afm_file (String);
50 Box afm_bbox_to_box (AFM_BBox);
51
52 #endif /* AFM_HH */
53