blob: 8da29c3e5c37999ec9e664af79ca8c27100362b7 (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#!/bin/sh
#
# ===================================================================
# M Goossens, S Rahtz. June 10 1995. revised December 5th 1995, March 1997
#
# Given a multiple master font, and values for up to 4 design space
# variables (how many, depends on the font), create AFM instances by
# creating normalized weight factors, and applying them to the master
# AFM files.
#
# Procedure:
# 1. create small PS file to invoke MM operators in PostScript
# with right values
# 2. run GhostScript on file to derive normalized weights
# 3. run mmafm program to read master AFM files and write new one
# 4. write map entry and .pro header file
# ===================================================================
#echo "usage makeinstance fontname instancename design-space-variables 1 to 4"
X=$2.control
cat > $$.instance <<FOOBAR
/myfile (myfile) (w) file def
/str 20 string def
/MASTERFONT findfont dup begin [
V1 V2 V3 V4 NormalizeDesignVector ConvertDesignVector
counttomark 1 sub -1 0 {
index str cvs myfile exch writestring
myfile (\n) writestring} for
myfile closefile
] end
FOOBAR
#-----------------------------------
MASTERFONT="$1"
V1="$3"
V2="$4"
V3="$5"
V4="$6"
sed -e "s/MASTERFONT/$MASTERFONT/" \
-e "s/V1/$V1/" \
-e "s/V2/$V2/" \
-e "s/V3/$V3/" \
-e "s/V4/$V4/" \
< $$.instance > $$.ps
rm $$.instance
gs -dNODISPLAY `kpsewhich -format=.pfa $1.PFA` $$.ps quit.ps
rm $$.ps
#----------------------------------
#
# build control file for mmafm
#
#----------------------------------
# number of weights
wc -l myfile | awk '{print $1}' > $X
# master AFM file names
cat $1.afmnames >> $X
# new name
echo $2 >> $X
# weights
cat myfile >> $X
#----------------------------------
rm myfile
mmafm $X | \
sed -e "/^FontName/s/^FontName .*$/FontName $1-$3-$4-$5-$6/" \
-e "/^FontName/s/-*$//" > $2.afm
#----------------------------------
echo "/$2 /$1 findfont dup begin [" > $2.pro
echo " $V1 $V2 $V3 $V4 NormalizeDesignVector ConvertDesignVector" >>$2.pro
echo " ] end makeblendedfont definefont pop " >>$2.pro
#----------------------------------
exit
|