-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakeall_2v.sh
executable file
·86 lines (72 loc) · 2.59 KB
/
makeall_2v.sh
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
FONT=MinionPro
# temporary directory
TEMPF=~/temp/
V1=$TEMPF/$FONT"V1"
V2=$TEMPF/$FONT"V2"
SCRIPTS=~/fontdev/FontPro # generating scripts
OTF=~/otf/${FONT} # font files
# version 1 fonts
V1F="${FONT}-BoldCapt.otf ${FONT}-ItSubh.otf \
${FONT}-BoldDisp.otf \
${FONT}-BoldItCapt.otf \
${FONT}-BoldItDisp.otf ${FONT}-Regular.otf \
${FONT}-BoldIt.otf ${FONT}-SemiboldCapt.otf \
${FONT}-BoldItSubh.otf ${FONT}-SemiboldDisp.otf \
${FONT}-Bold.otf ${FONT}-SemiboldItCapt.otf \
${FONT}-BoldSubh.otf ${FONT}-SemiboldItDisp.otf \
${FONT}-Capt.otf ${FONT}-SemiboldIt.otf \
${FONT}-Disp.otf ${FONT}-SemiboldItSubh.otf \
${FONT}-ItCapt.otf ${FONT}-Semibold.otf \
${FONT}-ItDisp.otf ${FONT}-SemiboldSubh.otf \
${FONT}-It.otf ${FONT}-Subh.otf"
# version 2 fonts
V2F="${FONT}-MediumCapt.otf ${FONT}-MediumItCapt.otf ${FONT}-Medium.otf ${FONT}-MediumIt.otf"
# prepare temporary folders
rm -rf $V1 $V2
cp -r ${SCRIPTS} $V1
cp -r ${SCRIPTS} $V2
mkdir $V1/otf $V2/otf
for i in $V1F; do
cp ${OTF}/$i $V1/otf
done
for i in $V2F; do
cp ${OTF}/$i $V2/otf
done
# patch version 2 to remove some checking and generating
# patch only fit to my very needs
patch -d $V2/ -p1 < ${FONT}v2.patch
# generate tex files
cd $V1
./scripts/makeall ${FONT} --pack=scripts/${FONT}-glyph-list-1.011
cd $V2
./scripts/makeall ${FONT} --pack=scripts/${FONT}-glyph-list-2.015
# rename and modify encoding files
cd $V1
for i in dvips/base*.enc
do
let=${i##*-}
let=${let%.enc}
sed s/Encoding-${let}/Encoding-${let}v1000/1 < $i > ${i%.enc}v1000.enc
rm $i
done
cd $V2
for i in dvips/base*.enc
do
let=${i##*-}
let=${let%.enc}
sed s/Encoding-${let}/Encoding-${let}v2000/1 < $i > ${i%.enc}v2000.enc
rm $i
done
# copy everything from version 2 to 1
cp $V2/dvips/base*.enc $V1/dvips/
cp $V2/dvips/$FONT.map $V1/dvips/tempv2.map
cp $V2/pfb/* $V1/pfb
cp $V2/tfm/* $V1/tfm
cp $V2/vf/* $V1/vf
# modify map files to reflect changes of enc files
cd $V1/dvips/
sed 's/Encoding-\(..\)/Encoding-\1v1000/g;s/MinionPro-\(a.\)/MinionPro-\1v1000/g;s/Medium\(.\{0,6\}\) "MinionPro-Base-Encoding-\(..\)v1000 ReEncodeFont" <\[base-MinionPro-..v1000.enc/Medium\1 "MinionPro-Base-Encoding-\2v2000 ReEncodeFont" <\[base-MinionPro-\2v2000.enc/g' <MinionPro.map > v1.map
sed 's/Encoding-\(..\)/Encoding-\1v1000/g;s/MinionPro-\(a.\)/MinionPro-\1v1000/g;s/Medium\(.\{0,6\}\) "MinionPro-Base-Encoding-\(..\)v1000 ReEncodeFont" <\[base-MinionPro-..v1000.enc/Medium\1 "MinionPro-Base-Encoding-\2v2000 ReEncodeFont" <\[base-MinionPro-\2v2000.enc/g' <tempv2.map > v2.map
# join map files
cat v1.map v2.map > $FONT.map