A new version of the corrected AFM file handling.
I noticed a number of problems with the new release:
- Textual scripts and dynamics are printed in the middle of the staff.
- I didn't find any working example of the Staff_margin-engraver in
input/test, and I couldn't invent one myself either.
bar-scripts.ly, score-bar-scripts.ly and hara-kiri.ly don't work
properly.
/Mats
--------------------------------
Generated by (address unknown) using package-diff 0.62,
>From = lilypond-1.1.24, To = lilypond-1.1.24.mb1
usage
cd lilypond-source-dir; patch -E -p1 < lilypond-1.1.24.mb1.diff
Patches do not contain automatically generated files
or (urg) empty directories,
i.e., you should rerun autoconf, configure
and possibly make outdirs.
--state
1.1.24
1.1.24.mb1
++state
diff -urN ../lilypond-1.1.24/Documentation/tex/refman.yo ./Documentation/tex/refman.yo
--- ../lilypond-1.1.24/Documentation/tex/refman.yo Mon Jan 25 22:38:25 1999
+++ ./Documentation/tex/refman.yo Mon Jan 25 20:59:19 1999
@@ -1425,7 +1425,6 @@
Mystery properties:
bar-number-engraver.cc: "barScriptPadding" vertical space for numbers
-mark-engraver.cc: "markScriptPadding" vertical space for marks
span-bar-engraver.cc: "singleStaffBracket" do single staffs get a bracket?
bar-column-engraver.cc: "barColumnPriority"
bar-number-engraver.cc: "barNumberBreakPriority" Control horizontal ordering
diff -urN ../lilypond-1.1.24/NEWS ./NEWS
--- ../lilypond-1.1.24/NEWS Mon Jan 25 22:38:25 1999
+++ ./NEWS Mon Jan 25 22:36:28 1999
@@ -1,3 +1,6 @@
+pl 24.mb1
+ - bf: Correct units now used in the .afm files.
+
pl 24, Hacking Apart Together (Jan 25)
pl 23.jbr1
diff -urN ../lilypond-1.1.24/VERSION ./VERSION
--- ../lilypond-1.1.24/VERSION Mon Jan 25 22:38:25 1999
+++ ./VERSION Mon Jan 25 22:35:36 1999
@@ -2,7 +2,7 @@
MAJOR_VERSION=1
MINOR_VERSION=1
PATCH_LEVEL=24
-MY_PATCH_LEVEL=
+MY_PATCH_LEVEL=mb1
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
diff -urN ../lilypond-1.1.24/buildscripts/mf-to-table.py ./buildscripts/mf-to-table.py
--- ../lilypond-1.1.24/buildscripts/mf-to-table.py Mon Oct 5 12:48:08 1998
+++ ./buildscripts/mf-to-table.py Mon Jan 25 20:57:23 1999
@@ -112,7 +112,7 @@
class Afm_file (File):
def print_f_dimen(self, f):
- f = f * 1000
+ f = f * 1000 / self.fontsize
dimstr = '%.2f' % f
@@ -189,7 +189,7 @@
afm.write ('FontName %s\n' % name)
afm.start ('FontMetrics')
afm.start ('CharMetrics')
-
+ afm.fontsize = atof(tags[2])
elif label == "group":
ly.indent()
ly.print_lit(name)
diff -urN ../lilypond-1.1.24/buildscripts/tfmtoafm.sh ./buildscripts/tfmtoafm.sh
--- ../lilypond-1.1.24/buildscripts/tfmtoafm.sh Fri Nov 13 12:50:09 1998
+++ ./buildscripts/tfmtoafm.sh Mon Jan 25 20:58:37 1999
@@ -9,8 +9,9 @@
fi
font=$1
+size=`echo $font | sed "s/[^0-9]*//"`
afm=$1.afm
-fontfile=`locate $1.tfm`
+fontfile=`kpsewhich $1.tfm`
t1=/tmp/tfmtoafm1-$$
t2=/tmp/tfmtoafm2-$$
rm -f $t1 $t2 $font $afm
@@ -18,10 +19,12 @@
for i in `seq 1 127`; do printf "%d Character-%d\n" $i $i >> $t1; done
tfmtodit $fontfile $t1 $font
rm $t1
+scaling=`nawk -v OFMT='%.5f' '/designsize/ {print $2/'$size/1000} $font`
tail -127 $font | cut -f 1-2 > $t1
cat $t1 | cut -d, -f 1-2 > $t2
rm $t1
-nl -ba $t2 | sed "s/,/ /g" | sed "s/^ *//" | sed "s/$/ /" | sed "s/^[0-9]*/C &;/" |
sed "s/\([0-9]\)\([0-9][0-9][0-9][0-9][0-9]\) /\1.\2 /"g | sed "s/-[0-9]*/&; B 0.00
0.00 /" > $t1
+nl -ba $t2 | nawk -F '[ \t,]+' '{print "C "$2";\t"$3";\tB 0.00 0.00 "$4/'"$scaling"'"
+"$5/'"$scaling"'";"}' > $t1
+
cat > $afm <<EOF
FontName cmr
StartFontMetrics
diff -urN ../lilypond-1.1.24/lily/afm-reader.cc ./lily/afm-reader.cc
--- ../lilypond-1.1.24/lily/afm-reader.cc Mon Jan 4 10:23:11 1999
+++ ./lily/afm-reader.cc Mon Jan 25 22:06:02 1999
@@ -11,6 +11,7 @@
#include "afm.hh"
#include "data-file.hh"
#include "string-convert.hh"
+#include <ctype.h>
Box
@@ -29,16 +30,17 @@
strip_leading_white (String c)
{
int i=0;
- while (c[i] == ' ')
+ while (isspace(c[i]))
i++;
c = c.cut_str (i, INT_MAX);
return c;
}
Adobe_font_char_metric
-read_char_metric (String s)
+read_char_metric (String s, int size)
{
Adobe_font_char_metric char_metric;
+ char_metric.size_ = size;
Array<String> a= String_convert::split_arr (s, ';');
for (int i=0; i < a.size (); i++)
{
@@ -47,18 +49,18 @@
Array<String> b = String_convert::split_arr (c, ' ');
if (b[0] == "C")
char_metric.C_ = b[1].value_i ();
- if (b[0] == "WX")
+ else if (b[0] == "WX")
char_metric.WX_ = b[1].value_f ();
- if (b[0] == "N")
+ else if (b[0] == "N")
char_metric.N_ = strip_leading_white (b[1]);
- if (b[0] == "B")
+ else if (b[0] == "B")
char_metric.B_ = parse_box (b.slice (1, b.size()));
}
return char_metric;
}
void
-Adobe_font_metric::read_char_metrics (Data_file &input)
+Adobe_font_metric::read_char_metrics (Data_file &input, int size)
{
while (!input.eof_b ())
{
@@ -66,7 +68,7 @@
String s= input.get_line ();
if (s == "EndCharMetrics")
return ;
- Adobe_font_char_metric afm_char =read_char_metric (s);
+ Adobe_font_char_metric afm_char =read_char_metric (s, size);
char_metrics_.push (afm_char);
int i = char_metrics_.size ()-1;
ascii_to_metric_idx_ [afm_char.C_] = i;
@@ -108,9 +110,14 @@
assert (!input.eof_b ());
+ int i = fn.index_i(".afm");
+ for (; i>0 && isdigit(fn[--i]); )
+ {}
+ int font_size = String_convert::dec2_i(fn.cut_str(i+1,INT_MAX));
+
Adobe_font_metric afm;
- for (int i=0; i < 256; i++)
+ for (i=0; i < 256; i++)
{
afm.ascii_to_metric_idx_.push (-1);
}
@@ -145,7 +152,7 @@
if (key == "StartCharMetrics")
{
input.get_line ();
- afm.read_char_metrics (input);
+ afm.read_char_metrics (input, font_size);
}
if (key == "EndFontMetrics")
break;
diff -urN ../lilypond-1.1.24/lily/afm.cc ./lily/afm.cc
--- ../lilypond-1.1.24/lily/afm.cc Mon Jan 25 22:38:25 1999
+++ ./lily/afm.cc Mon Jan 25 21:31:25 1999
@@ -59,8 +59,8 @@
{
Box b= B_;
- b[X_AXIS] *= 1/1000.0;
- b[Y_AXIS] *= 1/1000.0;
+ b[X_AXIS] *= size_ / 1000.0;
+ b[Y_AXIS] *= size_ / 1000.0;
return b;
}
diff -urN ../lilypond-1.1.24/lily/include/afm.hh ./lily/include/afm.hh
--- ../lilypond-1.1.24/lily/include/afm.hh Mon Jan 25 22:38:26 1999
+++ ./lily/include/afm.hh Mon Jan 25 21:36:55 1999
@@ -21,6 +21,7 @@
Real WX_;
String N_;
Box B_;
+ int size_;
Box &bbox();
String &name();
Real &width();
@@ -53,7 +54,7 @@
Adobe_font_char_metric const &find_ascii (int ascii,bool warn) const;
String str () const;
Adobe_font_metric ();
- void read_char_metrics (Data_file &input);
+ void read_char_metrics (Data_file &input, int size);
Character_metric *get_char (int, bool) const;
diff -urN ../lilypond-1.1.24/lily/lookup.cc ./lily/lookup.cc
--- ../lilypond-1.1.24/lily/lookup.cc Mon Jan 25 22:38:26 1999
+++ ./lily/lookup.cc Mon Jan 25 21:35:29 1999
@@ -80,11 +80,8 @@
Atom a;
if (m.code () < 0)
return a;
-
- a.dim_ = m.B_;
- a.dim_[X_AXIS] *= 1 / 1000.0;
- a.dim_[Y_AXIS] *= 1 / 1000.0;
-
+
+ a.dim_ = m.dimensions();
a.lambda_ = gh_list (ly_symbol ("char"),
gh_int2scm (m.code ()),