]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/tfm-reader.cc
* lily/bar-line.cc (compound_barline): Fix parenthesis error,
[lilypond.git] / lily / tfm-reader.cc
index 1b6862ec02fe8ed3da6caa4651eb37e89143a344..b41630113470c4bc794137e0e1407a1a95e0ad54 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1999--2005 Jan Nieuwenhuizen <janneke@gnu.org>
+  (c) 1999--2006 Jan Nieuwenhuizen <janneke@gnu.org>
 
 
   some code shamelessly copied from GNU fontutils-0.6/tfm/tfm_input.c
@@ -11,6 +11,7 @@
 
 #include "tfm-reader.hh"
 
+#include "international.hh"
 #include "string-convert.hh"
 #include "warn.hh"
 
   (1 << 20)
 static const Real fix_to_real (Fix f);
 
-Tex_font_metric_reader::Tex_font_metric_reader (String name)
+Tex_font_metric_reader::Tex_font_metric_reader (string name)
   : input_ (name)
 {
 
-  for (int i = 0; i < TFM_SIZE; i++)
-    ascii_to_metric_idx_.push (-1);
+  for (vsize i = 0; i < TFM_SIZE; i++)
+    ascii_to_metric_idx_.push_back (VPOS);
 
   read_header ();
   read_params ();
   read_char_metrics ();
-
 }
 
 static const Real
@@ -55,11 +55,11 @@ Tex_font_metric_reader::get_U32_fix_scaled ()
   return get_U32_fix () * info_.design_size;
 }
 
-String
+string
 Tex_font_metric_reader::get_bcpl_string ()
 {
   U8 length_u8 = input_.get_U8 ();
-  String str = input_.get_string (length_u8);
+  string str = input_.get_string (length_u8);
   return str;
 }
 
@@ -105,7 +105,7 @@ Tex_font_metric_reader::read_header ()
     /* Not using ngettext's plural feature here, as this message is
        more of a programming error.  */
     error (_f ("TFM header of `%s' has only %u word (s)",
-              input_.name_string ().to_str0 (), header_length));
+              input_.name_string ().c_str (), header_length));
 
   info_.checksum = input_.get_U32 ();
   info_.design_size = get_U32_fix ();
@@ -114,7 +114,6 @@ Tex_font_metric_reader::read_header ()
      font family and face byte probably aren't.  So we don't read them.  */
   info_.coding_scheme = header_length > 2
     ? get_bcpl_string () : "unspecified";
-
 }
 
 /* Although TFM files are only usable by TeX if they have at least seven
@@ -139,7 +138,7 @@ Tex_font_metric_reader::read_params ()
   if (header_.param_word_count > TFM_MAX_FONTDIMENS)
     {
       warning (_f ("%s: TFM file has %u parameters, which is more than the %u I can handle",
-                  input_.name_string ().to_str0 (),
+                  input_.name_string ().c_str (),
                   header_.param_word_count,
                   TFM_MAX_FONTDIMENS));
       header_.param_word_count = TFM_MAX_FONTDIMENS;
@@ -151,7 +150,6 @@ Tex_font_metric_reader::read_params ()
 
   for (Char_code i = 2; i <= header_.param_word_count; i++)
     info_.parameters[i - 1] = get_U32_fix_scaled ();
-
 }
 
 /* Read every character in the TFM file, storing the result in the
@@ -165,7 +163,7 @@ Tex_font_metric_reader::read_char_metrics ()
       Tex_font_char_metric tfm_char = read_char_metric (i);
       if (tfm_char.exists_)
        ascii_to_metric_idx_[tfm_char.code_] = char_metrics_.size ();
-      char_metrics_.push (tfm_char);
+      char_metrics_.push_back (tfm_char);
     }
 }
 
@@ -222,7 +220,7 @@ Tex_font_metric_reader::read_char ()
 #define GET_CHAR_DIMEN(d)                                      \
   if (d##_index != 0)                                          \
     {                                                          \
-      input_.seek_str0 (header_. d##_pos + d##_index*4);       \
+      input_.seek_str0 (header_.d##_pos + d##_index * 4);      \
       tfm_char.d##_fix_ = input_.get_U32 ();                   \
       tfm_char.d##_ = fix_to_real (tfm_char.d##_fix_)          \
        * info_.design_size;                                    \
@@ -257,7 +255,7 @@ Tex_font_metric_reader::read_char ()
 #define KERN_FLAG 128
 
 void
-Tex_font_metric_reader::read_lig_kern_program (Array<Tfm_ligature>* ligatures, Array<Tfm_kern>* kerns)
+Tex_font_metric_reader::read_lig_kern_program (vector<Tfm_ligature> *ligatures, vector<Tfm_kern> *kerns)
 {
   bool end_b;
 
@@ -279,19 +277,16 @@ Tex_font_metric_reader::read_lig_kern_program (Array<Tfm_ligature>* ligatures, A
          kern_element.kern = get_U32_fix_scaled ();
          input_.set_pos (old_pos);
 
-         kerns->push (kern_element);
-
+         kerns->push_back (kern_element);
        }
       else
        {
          Tfm_ligature ligature_element;
          ligature_element.character = next_char;
          ligature_element.ligature = remainder;
-         ligatures->push (ligature_element);
-
+         ligatures->push_back (ligature_element);
        }
     }
   while (!end_b);
-
 }