blob: f6bfeb045f14a6a789fb575f39cd57a657b23516 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#! /bin/sh
# Make a reduced version of an AFM file
# usage: mk-red scale afm-file-name >new-afm-file-name
#
# rounding is done with int(x+0.5) --- this is wrong for -ve values
# doesn't deal with composites
awk 'BEGIN {'scale=$1'; }
/^FontName/ {
print $0 "-Reduced";
next;
}
/^FullName/ {
print $0, "Reduced";
next;
}
/^Underline/ || /^CapHeight/ || /^XHeight/ || /^Descender/ || /^Ascender/ {
print $1, int($2*scale + 0.5); next;
}
/^FontBBox/ {
print "FontBBox", int($2*scale+0.5), int($3*scale+0.5), int($4*scale+0.5), int($5*scale+0.5);
next;
}
/^C / {
$5 = int($5 * scale + 0.5);
$11 = int($11 * scale + 0.5);
$12 = int($12 * scale + 0.5);
$13 = int($13 * scale + 0.5);
$14 = int($14 * scale + 0.5);
print $0; next;
}
/^KPX/ {
$4 = int($4*scale - 0.5)
print $0; next;
}
{print}' $2
|