/*
- tfm.cc -- implement Tex_font_metric
+ tfm.cc -- implement Tex_font_metric
source file of the GNU LilyPond music typesetter
- (c) 1999--2000 Jan Nieuwenhuizen <janneke@gnu.org>
+ (c) 1999--2002 Jan Nieuwenhuizen <janneke@gnu.org>
some code shamelessly copied from GNU fontutils-0.6/tfm/tfm_input.c
Box
Tex_font_char_metric::dimensions () const
{
+ if (!exists_b_)
+ {
+ Box b;
+ b.set_empty ();
+ return b;
+ }
+
Real d = -depth_;
- return Box (Interval (0, width_),Interval ( d <? height_, d >? height_));
+ return Box (Interval (0, width_),Interval (d <? height_, d >? height_));
}
Tex_font_char_metric::Tex_font_char_metric ()
Tex_font_char_metric const *
Tex_font_metric::find_ascii (int ascii, bool warn) const
{
- if (ascii < ascii_to_metric_idx_.size() && ascii_to_metric_idx_[ascii] >= 0)
+ if (ascii < ascii_to_metric_idx_.size () && ascii_to_metric_idx_[ascii] >= 0)
return & char_metrics_[ascii_to_metric_idx_ [ascii]];
else if (warn)
-
{
- warning (_f ("can't find ascii character %d", ascii));
+ warning (_f ("can't find ascii character: %d", ascii));
}
return &dummy_static_char_metric;
}
+
+/*
+ UGH: glyphs need not be consecutive in TFM.
+ */
+int
+Tex_font_metric::count () const
+{
+ for (int i = ascii_to_metric_idx_.size (); i--;)
+ {
+ if (ascii_to_metric_idx_[i] != -1)
+ return i + 1;
+ }
+ return 0;
+}
+
Box
Tex_font_metric::get_char (int a) const
{