-/*
+/*
tfm.hh -- declare Tex_font_metric
-
+
source file of the GNU LilyPond music typesetter
-
- (c) 1999--2001 Jan Nieuwenhuizen <janneke@gnu.org>
+ (c) 1999--2006 Jan Nieuwenhuizen <janneke@gnu.org>
- revamped code from GNU Fontutils-0.6
- */
+ revamped code from GNU Fontutils-0.6
+*/
/*
TODO: aren't there standard libs? Ideally it is better to just link
#ifndef TFM_HH
#define TFM_HH
-#include "string.hh"
-#include "array.hh"
-#include "lily-proto.hh"
+#include "std-vector.hh"
#include "font-metric.hh"
/* The type. */
Char_code first_charcode, last_charcode;
U32 checksum;
Real design_size;
- String coding_scheme;
+ string coding_scheme;
unsigned parameter_count;
// Real parameters [Tex_font_metric::MAX_FONTDIMENS];
Real parameters [TFM_MAX_FONTDIMENS];
struct Tex_font_char_metric
{
- bool exists_b_;
+ bool exists_;
Char_code code_;
Real width_, height_, depth_, italic_correction_;
Fix width_fix_, height_fix_, depth_fix_, italic_correction_fix_;
- Array<Tfm_kern> kern_arr_;
- Array<Tfm_ligature> ligature_arr_;
+ vector<Tfm_kern> kerns_;
+ vector<Tfm_ligature> ligatures_;
- String str () const;
Tex_font_char_metric ();
- Box dimensions () const;
+ Box dimensions () const;
};
-
-class Tex_font_metric : public Font_metric
+class Tex_font_metric : public Simple_font_metric
{
-public:
- static SCM make_tfm (String filename);
+ DECLARE_CLASSNAME(Tex_font_metric);
- virtual int count () const;
- virtual Box get_char (int) const;
- Tex_font_char_metric const *find_ascii (int ascii, bool warn=true) const;
+public:
+ static SCM make_tfm (string file_name);
- String str () const;
+ vsize count () const;
+ Box get_ascii_char (vsize) const;
+ Real design_size () const;
+ void derived_mark () const;
+ vsize name_to_index (string) const;
+ string font_name () const;
+ Tfm_info const &info () const;
-
+protected:
Tfm_info info_;
Tfm_header header_;
- Array<Tex_font_char_metric> char_metrics_;
- Array<int> ascii_to_metric_idx_;
+ vector<Tex_font_char_metric> char_metrics_;
+ vector<vsize> ascii_to_metric_idx_;
+ SCM encoding_table_;
+ string font_name_;
+
private:
+ Tex_font_char_metric const *find_ascii (vsize ascii, bool warn = true) const;
Tex_font_metric ();
};
-
#endif /* TFM_HH */