forked from yuru7/udev-gothic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathos2_patch.sh
executable file
·71 lines (55 loc) · 2.72 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
#!/bin/bash
BASE_DIR="$(cd $(dirname $0); pwd)/build_tmp"
FAMILYNAME="$1"
PREFIX="$2"
xAvgCharWidth_SETVAL=1024
FONT_PATTERN=${PREFIX}${FAMILYNAME}'[^3]*.ttf'
xAvgCharWidth35_SETVAL=1000
FONT35_PATTERN=${PREFIX}${FAMILYNAME}'*.ttf'
for P in ${BASE_DIR}/${FONT_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"
underlinePosition_value=$(grep 'underlinePosition value' "${P%%.ttf}.ttx" | awk -F\" '{print $2}')
sed -i.bak -e 's,underlinePosition value="'$underlinePosition_value'",underlinePosition value="-70",' "${P%%.ttf}.ttx"
sed -i.bak -e 's,<isFixedPitch value="0"/>,<isFixedPitch value="1"/>,' "${P%%.ttf}.ttx"
mv "$P" "${P}_orig"
ttx -m "${P}_orig" "${P%%.ttf}.ttx"
done
# for P in ${BASE_DIR}/${FONT35_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"
# underlinePosition_value=$(grep 'underlinePosition value' "${P%%.ttf}.ttx" | awk -F\" '{print $2}')
# 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"
# done
rm -f "${BASE_DIR}/"*.ttx