2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 1999--2014 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 #include "font-metric.hh"
26 #include "dimensions.hh"
27 #include "modified-font-metric.hh"
28 #include "open-type-font.hh"
34 Font_metric::design_size () const
36 return 1.0 * point_constant;
40 Font_metric::find_by_name (string s) const
42 replace_all (&s, '-', 'M');
43 int idx = name_to_index (s);
49 expr = scm_list_3 (ly_symbol2scm ("named-glyph"),
52 b = get_indexed_char_dimensions (idx);
59 Font_metric::Font_metric ()
61 description_ = SCM_EOL;
65 Font_metric::Font_metric (Font_metric const &)
66 : Smob<Font_metric> ()
70 Font_metric::~Font_metric ()
75 Font_metric::count () const
81 Font_metric::get_indexed_char_dimensions (size_t) const
83 return Box (Interval (0, 0), Interval (0, 0));
87 Font_metric::get_indexed_wxwy (size_t) const
93 Font_metric::derived_mark () const
98 Font_metric::mark_smob ()
105 Font_metric::print_smob (SCM port, scm_print_state *)
107 scm_puts ("#<", port);
108 scm_puts (class_name (), port);
109 scm_puts (" ", port);
110 scm_write (description_, port);
111 scm_puts (">", port);
115 const char Font_metric::type_p_name_[] = "ly:font-metric?";
118 Font_metric::font_file_name () const
120 return scm_car (description_);
124 Font_metric::font_name () const
126 string s ("unknown");
131 Font_metric::index_to_charcode (size_t i) const
137 Font_metric::attachment_point (const string&) const
139 return Offset (0, 0);
143 Font_metric::sub_fonts () const
149 Font_metric::text_stencil (Output_def *state,
150 const string&, bool) const
154 programming_error ("Cannot get a text stencil from this font");
155 return Stencil (Box (), SCM_EOL);