2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 1999--2010 Han-Wen Nienhuys <hanwen@xs4all.nl>
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.
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.
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/>.
20 #ifndef FONT_METRIC_HH
21 #define FONT_METRIC_HH
24 #include "lily-proto.hh"
26 #include "virtual-methods.hh"
27 #include "freetype.hh"
32 typedef map<FT_UInt, FT_ULong> Index_to_charcode_map;
36 DECLARE_CLASSNAME(Font_metric);
42 virtual Stencil text_stencil (string, bool) const;
45 virtual Box text_dimension (string) const;
47 virtual string font_name () const;
48 virtual size_t count () const;
49 virtual Offset attachment_point (string) const;
50 virtual Offset get_indexed_wxwy (size_t) const;
51 virtual Box get_indexed_char (size_t index) const;
52 virtual Box get_ascii_char (size_t ascii) const;
57 Font_metric is not related to vector<>
59 virtual size_t name_to_index (string) const;
60 virtual size_t index_to_charcode (size_t) const;
61 virtual size_t index_to_ascii (size_t) const;
62 virtual Real design_size () const;
63 virtual Stencil find_by_name (string) const;
64 virtual Stencil get_indexed_char_stencil (size_t k) const;
65 virtual Stencil get_ascii_char_stencil (size_t k) const;
66 virtual SCM sub_fonts () const;
67 virtual SCM font_file_name () const;
68 DECLARE_SMOBS (Font_metric);
71 /* No copying, no implicit copy constructor. */
72 Font_metric (Font_metric const &);
75 virtual void derived_mark () const;
80 int get_encoded_index (Font_metric *m, string input_coding, int code);
82 class Simple_font_metric : public Font_metric
84 DECLARE_CLASSNAME(Simple_font_metric);
88 DECLARE_UNSMOB (Font_metric, metrics);
90 char *pfb2pfa (Byte const *pfb, int length);
92 #endif /* FONT_METRIC_HH */