summaryrefslogtreecommitdiff
path: root/lily/afm.cc
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@xs4all.nl>1998-08-11 01:45:43 +0200
committerHan-Wen Nienhuys <hanwen@xs4all.nl>1998-08-11 01:45:43 +0200
commit1cf3d59c1559fb9774c4c1c8cae155cfe54a927c (patch)
treecbfa7cce6bae38537b71ee355d0f3b5d74a201e5 /lily/afm.cc
parent1e95a0be01466d1c98644f7705c8e07e41cc645c (diff)
release: 1.0.1
Diffstat (limited to 'lily/afm.cc')
-rw-r--r--lily/afm.cc118
1 files changed, 118 insertions, 0 deletions
diff --git a/lily/afm.cc b/lily/afm.cc
new file mode 100644
index 0000000000..2935a8a967
--- /dev/null
+++ b/lily/afm.cc
@@ -0,0 +1,118 @@
+/*
+ afm.cc -- implement Adobe_font_metric
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include "afm.hh"
+#include "box.hh"
+#include "direction.hh"
+#include "debug.hh"
+
+Box &
+Adobe_font_char_metric::bbox ()
+{
+ return B_;
+}
+
+String &
+Adobe_font_char_metric::name ()
+{
+ return N_;
+
+}
+
+int &
+Adobe_font_char_metric::code ()
+{
+ return C_;
+}
+
+Real &
+Adobe_font_char_metric::width ()
+{
+ return WX_;
+}
+
+Adobe_font_char_metric::Adobe_font_char_metric ()
+{
+ C_ = 0;
+}
+
+Adobe_font_metric::Adobe_font_metric ()
+{
+ ItalicAngle_ = 0.0;
+ IsFixedPitch_ = false;
+ UnderlinePosition_ =0.;
+ UnderlineThickness_=0.;
+}
+
+
+#define APPEND_CHAR_METRIC_ELT(k) outstr += to_str (#k) + " " + to_str (k ## _) + "; "
+
+String
+box_str (Box b)
+{
+ return to_str (b[X_AXIS][SMALLER]) + " " +
+ to_str(b[Y_AXIS][SMALLER]) + " " +
+ to_str (b[X_AXIS][BIGGER]) + " "+
+ to_str (b[Y_AXIS][BIGGER]);
+}
+
+#define APPEND_BOX(k) outstr += to_str (#k) + " " + box_str (k ## _) + ";"
+
+String
+Adobe_font_char_metric::str () const
+{
+ String outstr ;
+
+ APPEND_CHAR_METRIC_ELT (C);
+ APPEND_CHAR_METRIC_ELT(N);
+ APPEND_CHAR_METRIC_ELT(WX);
+
+ APPEND_BOX(B);
+ return outstr + "\n";
+}
+
+#define WRITESTRING(k) outstr += String (#k) + " " + to_str (k ## _) + "\n"
+
+String
+Adobe_font_metric::str () const
+{
+ String outstr;
+ WRITESTRING(FontName);
+ WRITESTRING(FullName);
+ WRITESTRING(FamilyName);
+ WRITESTRING(Weight);
+ WRITESTRING(Version);
+ WRITESTRING(Notice);
+ WRITESTRING(EncodingScheme);
+ WRITESTRING(ItalicAngle);
+ WRITESTRING(UnderlineThickness);
+ WRITESTRING(UnderlinePosition);
+ outstr += "FontBBox " + box_str (FontBBox_) + "\n";
+
+ for (int i=0; i < char_metrics_.size (); i++)
+ outstr += char_metrics_[i].str ();
+
+ return outstr;
+}
+
+/*
+ UGH. should have hashtable.
+ */
+Adobe_font_char_metric
+Adobe_font_metric::find_char (String nm) const
+{
+ for (int i=0; i < char_metrics_.size (); i++)
+ if (char_metrics_[i].N_ == nm)
+ return char_metrics_[i];
+
+ warning (_f ("can't find character called `%s'", nm.ch_C()));
+
+ Adobe_font_char_metric a;
+ return a;
+}