-
Notifications
You must be signed in to change notification settings - Fork 5
/
os2_patch.sh
executable file
·82 lines (65 loc) · 3.22 KB
/
os2_patch.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
#!/bin/bash
BASE_DIR=$(cd $(dirname $0); pwd)
PREFIX="$1"
xAvgCharWidth_SETVAL=528
FIRGE_PATTERN=${PREFIX}'MonoplexKR[^3]*.ttf'
xAvgCharWidth35_SETVAL=1000
FIRGE35_PATTERN=${PREFIX}'MonoplexKRWide*.ttf'
for P in ${BASE_DIR}/${FIRGE_PATTERN}; do
ttx -t OS/2 -t post "$P"
xAvgCharWidth_value=$(grep xAvgCharWidth "${P%%.ttf}.ttx" | awk -F\" '{print $2}')
sed -i.bak -e 's,xAvgCharWidth value="'$xAvgCharWidth_value'",xAvgCharWidth value="'${xAvgCharWidth_SETVAL}'",' "${P%%.ttf}.ttx"
fsSelection_value=$(grep fsSelection "${P%%.ttf}.ttx" | awk -F\" '{print $2}')
if [ `echo $P | grep Regular` ]; then
fsSelection_sed_value='00000001 01000000'
elif [ `echo $P | grep BoldItalic` ]; then
fsSelection_sed_value='00000001 00100001'
elif [ `echo $P | grep Bold` ]; then
fsSelection_sed_value='00000001 00100000'
elif [ `echo $P | grep Italic` ]; then
fsSelection_sed_value='00000001 00000001'
else
fsSelection_sed_value='00000001 00000000'
fi
sed -i.bak -e 's,fsSelection value="'"$fsSelection_value"'",fsSelection value="'"$fsSelection_sed_value"'",' "${P%%.ttf}.ttx"
#sed -i.bak -e 's,version value="1",version value="4",' "${P%%.ttf}.ttx"
underlinePosition_value=$(grep 'underlinePosition value' "${P%%.ttf}.ttx" | awk -F\" '{print $2}')
#sed -i.bak -e 's,underlinePosition value="'$underlinePosition_value'",underlinePosition value="-125",' "${P%%.ttf}.ttx"
sed -i.bak -e 's,underlinePosition value="'$underlinePosition_value'",underlinePosition value="-70",' "${P%%.ttf}.ttx"
mv "$P" "${P}_orig"
ttx -m "${P}_orig" "${P%%.ttf}.ttx"
if [ $? -eq 0 ]; then
mv -f "${P}_orig" "${BASE_DIR}/bak/"
mv -f "${P%%.ttf}.ttx" "${BASE_DIR}/bak/"
rm -f "${P%%.ttf}.ttx.bak"
fi
done
for P in ${BASE_DIR}/${FIRGE35_PATTERN}; do
ttx -t OS/2 -t post "$P"
xAvgCharWidth_value=$(grep xAvgCharWidth "${P%%.ttf}.ttx" | awk -F\" '{print $2}')
sed -i.bak -e 's,xAvgCharWidth value="'$xAvgCharWidth_value'",xAvgCharWidth value="'${xAvgCharWidth35_SETVAL}'",' "${P%%.ttf}.ttx"
fsSelection_value=$(grep fsSelection "${P%%.ttf}.ttx" | awk -F\" '{print $2}')
if [ `echo $P | grep Regular` ]; then
fsSelection_sed_value='00000001 01000000'
elif [ `echo $P | grep BoldItalic` ]; then
fsSelection_sed_value='00000001 00100001'
elif [ `echo $P | grep Bold` ]; then
fsSelection_sed_value='00000001 00100000'
elif [ `echo $P | grep Italic` ]; then
fsSelection_sed_value='00000001 00000001'
else
fsSelection_sed_value='00000001 00000000'
fi
sed -i.bak -e 's,fsSelection value="'"$fsSelection_value"'",fsSelection value="'"$fsSelection_sed_value"'",' "${P%%.ttf}.ttx"
#sed -i.bak -e 's,version value="1",version value="4",' "${P%%.ttf}.ttx"
underlinePosition_value=$(grep 'underlinePosition value' "${P%%.ttf}.ttx" | awk -F\" '{print $2}')
#sed -i.bak -e 's,underlinePosition value="'$underlinePosition_value'",underlinePosition value="-125",' "${P%%.ttf}.ttx"
sed -i.bak -e 's,underlinePosition value="'$underlinePosition_value'",underlinePosition value="-70",' "${P%%.ttf}.ttx"
mv "$P" "${P}_orig"
ttx -m "${P}_orig" "${P%%.ttf}.ttx"
if [ $? -eq 0 ]; then
mv -f "${P}_orig" "${BASE_DIR}/bak/"
mv -f "${P%%.ttf}.ttx" "${BASE_DIR}/bak/"
rm -f "${P%%.ttf}.ttx.bak"
fi
done