]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/font-metric.hh
Remove tex and texstr backends (part 1).
[lilypond.git] / lily / include / font-metric.hh
1 /*
2   font-metric.hh -- declare Font_metric
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1999--2008 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #ifndef FONT_METRIC_HH
10 #define FONT_METRIC_HH
11
12 #include "box.hh"
13 #include "lily-proto.hh"
14 #include "smobs.hh"
15 #include "virtual-methods.hh"
16 #include "freetype.hh"
17
18 #include <map>
19 using namespace std;
20
21 typedef map<FT_UInt, FT_ULong> Index_to_charcode_map;
22
23 class Font_metric
24 {
25   DECLARE_CLASSNAME(Font_metric);
26
27 public:
28   SCM description_;
29   string file_name_;
30
31   virtual Stencil text_stencil (string) const;
32   virtual Stencil word_stencil (string) const;
33
34   // ugh.
35   virtual Box text_dimension (string) const;
36
37   virtual string font_name () const;
38   virtual size_t count () const;
39   virtual Offset attachment_point (string) const;
40   virtual Offset get_indexed_wxwy (size_t) const;
41   virtual Box get_indexed_char (size_t index) const;
42   virtual Box get_ascii_char (size_t ascii) const;
43
44   /*
45     WTF are these vsize ?
46
47     Font_metric is not related to vector<> 
48    */
49   virtual size_t name_to_index (string) const;
50   virtual size_t index_to_charcode (size_t) const;
51   virtual size_t index_to_ascii (size_t) const;
52   virtual Real design_size () const;
53   virtual Stencil find_by_name (string) const;
54   virtual Stencil get_indexed_char_stencil (size_t k) const;
55   virtual Stencil get_ascii_char_stencil (size_t k) const;
56   virtual SCM sub_fonts () const;
57   virtual SCM font_file_name () const;
58   DECLARE_SMOBS (Font_metric);
59
60 private:
61   /* No copying, no implicit copy constructor.  */
62   Font_metric (Font_metric const &);
63
64 protected:
65   virtual void derived_mark () const;
66
67   Font_metric ();
68 };
69
70 int get_encoded_index (Font_metric *m, string input_coding, int code);
71
72 class Simple_font_metric : public Font_metric
73 {
74   DECLARE_CLASSNAME(Simple_font_metric);
75 public:
76 };
77
78 DECLARE_UNSMOB (Font_metric, metrics);
79
80 char *pfb2pfa (Byte const *pfb, int length);
81
82 #endif /* FONT_METRIC_HH */