2 afm.cc -- implement Adobe_font_metric
4 source file of the GNU LilyPond music typesetter
6 (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
12 #include "direction.hh"
16 Adobe_font_char_metric::bbox ()
22 Adobe_font_char_metric::name ()
29 Adobe_font_char_metric::code ()
35 Adobe_font_char_metric::width ()
40 Adobe_font_char_metric::Adobe_font_char_metric ()
45 Adobe_font_metric::Adobe_font_metric ()
48 IsFixedPitch_ = false;
49 UnderlinePosition_ =0.;
50 UnderlineThickness_=0.;
54 #define APPEND_CHAR_METRIC_ELT(k) outstr += to_str (#k) + " " + to_str (k ## _) + "; "
59 return to_str (b[X_AXIS][SMALLER]) + " " +
60 to_str(b[Y_AXIS][SMALLER]) + " " +
61 to_str (b[X_AXIS][BIGGER]) + " "+
62 to_str (b[Y_AXIS][BIGGER]);
65 #define APPEND_BOX(k) outstr += to_str (#k) + " " + box_str (k ## _) + ";"
68 Adobe_font_char_metric::str () const
72 APPEND_CHAR_METRIC_ELT (C);
73 APPEND_CHAR_METRIC_ELT(N);
74 APPEND_CHAR_METRIC_ELT(WX);
80 #define WRITESTRING(k) outstr += String (#k) + " " + to_str (k ## _) + "\n"
83 Adobe_font_metric::str () const
86 WRITESTRING(FontName);
87 WRITESTRING(FullName);
88 WRITESTRING(FamilyName);
92 WRITESTRING(EncodingScheme);
93 WRITESTRING(ItalicAngle);
94 WRITESTRING(UnderlineThickness);
95 WRITESTRING(UnderlinePosition);
96 outstr += "FontBBox " + box_str (FontBBox_) + "\n";
98 for (int i=0; i < char_metrics_.size (); i++)
99 outstr += char_metrics_[i].str ();
105 UGH. should have hashtable.
107 Adobe_font_char_metric
108 Adobe_font_metric::find_char (String nm, bool warn) const
110 for (int i=0; i < char_metrics_.size (); i++)
111 if (char_metrics_[i].N_ == nm)
112 return char_metrics_[i];
114 warning (_f ("can't find character called `%s'", nm.ch_C()));
116 Adobe_font_char_metric a;