]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/tfm.cc
new file.
[lilypond.git] / lily / tfm.cc
index 4e7d22f4fadb894ad3a27cc223ea1de6d0ecad1d..89a09a5011807a79027e05e1eef94f222e3c9d78 100644 (file)
@@ -3,7 +3,7 @@
   
   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
@@ -14,6 +14,7 @@
 #include "string-convert.hh"
 #include "debug.hh"
 #include "warn.hh"
+#include "dimensions.hh"
 
 Box
 Tex_font_char_metric::dimensions () const
@@ -26,7 +27,12 @@ Tex_font_char_metric::dimensions () const
     }
   
   Real d = -depth_;
-  return Box (Interval (0, width_),Interval ( d <? height_, d >? height_));
+
+  Real point_constant = 1 PT;
+  
+  return Box (Interval (0, width_*point_constant ),
+             Interval ((d <? height_)*point_constant,
+                       (d >? height_)*point_constant));
 }
 
 Tex_font_char_metric::Tex_font_char_metric ()
@@ -70,7 +76,7 @@ static Tex_font_char_metric dummy_static_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)
     {
@@ -79,6 +85,21 @@ Tex_font_metric::find_ascii (int ascii, bool warn) const
   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
 {