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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
#!/bin/sh
PATH=/bin:/usr/bin:/usr/local/bin
# Some mktexpk incorrectly calls ttf2pk with -p option, delete it.
cp ${PREFIX}/bin/mktexpk ${PREFIX}/bin/mktexpk.CJK
sed -e "s/ttf2pk -p/ttf2pk/" ${PREFIX}/bin/mktexpk.CJK > ${PREFIX}/bin/mktexpk
rm ${PREFIX}/bin/mktexpk.CJK
# Install ttf2pk binary in ${PORTSDIR}/print/freetype, data in ${TEXMF}/ttf2pk
(cd ${PORTSDIR}/print/freetype/work/freetype-1.2/contrib/ttf2pk;
./configure --prefix=${PREFIX} --with-kpathsea-dir=${PREFIX};
make depend all install;
cp -R data ${PREFIX}/share/texmf/ttf2pk;
cd ${PREFIX}/share/texmf; ln -s ttf2pk ttf2tfm; )
# We have no way telling where generated fonts are, but ask the user.
echo
echo Please input where generated fonts are placed.
echo "->(Default: ${PREFIX}/share/texmf/fonts)"
read VARTEXFONTS
if [ -z ${VARTEXFONTS} ]
then
VARTEXFONTS=${PREFIX}/share/texmf/fonts
fi
# Chmod 1777 pk/tfm font directory.
if [ -z "${NOCHMOD}" ]
then
chmod -R 1777 ${VARTEXFONTS}/tfm ${VARTEXFONTS}/pk
fi
# Install moe_* TTF fonts
if [ ${NOTTF} ]
then
echo ===
echo If you want to install other TTF fonts, you have to manually edit:
echo ${PREFIX}/share/texmf/fontname/special.map
echo ${PREFIX}/share/texmf/ttf2pk/ttfonts.map
echo ${PREFIX}/share/texmf/web2c/texmf.cnf
echo ${PREFIX}/share/texmf/tex/latex/CJK/Bg5/c00kai.fd, for Kai family fonts.
echo ${PREFIX}/share/texmf/tex/latex/CJK/Bg5/c00song.fd, for Song family fonts.
echo ===
else
mkdir -p ${PREFIX}/share/texmf/fonts/truetype/moe
install -c -o root -g wheel -m 644 ${DISTDIR}/moe_kai.ttf ${PREFIX}/share/texmf/fonts/truetype/moe
# moe_sung.ttf -> moe_song.ttf
install -c -o root -g wheel -m 644 ${DISTDIR}/moe_sung.ttf ${PREFIX}/share/texmf/fonts/truetype/moe/moe_sung.ttf
# fontname/special.map
if [ -n "`grep moekai ${PREFIX}/share/texmf/fontname/special.map`" ]
then
echo Seems moekai already in spcial.map, file untouched.
else
echo "@c BIG5 MOE TTF fonts" >> ${PREFIX}/share/texmf/fontname/special.map
echo "moekai big5 moekai" >> ${PREFIX}/share/texmf/fontname/special.map
fi
if [ -n "`grep moesung ${PREFIX}/share/texmf/fontname/special.map`" ]
then
echo Seems moesung already in spcial.map, file untouched.
else
echo "@c BIG5 MOE TTF fonts" >> ${PREFIX}/share/texmf/fontname/special.map
echo "moesung big5 moesung" >> ${PREFIX}/share/texmf/fontname/special.map
fi
# ttf2pk/ttfonts.map
if [ -n "`grep moekai ${PREFIX}/share/texmf/ttf2pk/ttfonts.map`" ]
then
echo Seems moekai already in ttfonts.map, file untouched.
else
echo "moekai@Big5.sfd@ moe_kai Pid=3 Eid=4" >> ${PREFIX}/share/texmf/ttf2pk/ttfonts.map
fi
if [ -n "`grep moesung ${PREFIX}/share/texmf/ttf2pk/ttfonts.map`" ]
then
echo Seems moesung already in ttfonts.map, file untouched.
else
echo "moesung@Big5.sfd@ moe_sung Pid=3 Eid=4" >> ${PREFIX}/share/texmf/ttf2pk/ttfonts.map
fi
# web2c/texmf.cnf
if [ -n "`grep TTF2PKINPUTS ${PREFIX}/share/texmf/web2c/texmf.cnf`" ]
then
echo Seems TTF2PKINPUTS already set in texmf.cnf, file untouched.
else
echo "% ttf2pk data directory" >> ${PREFIX}/share/texmf/web2c/texmf.cnf
echo "TTF2PKINPUTS = \$TEXMF/ttf2pk//" >> ${PREFIX}/share/texmf/web2c/texmf.cnf
fi
if [ -n "`grep TTF2TFMINPUTS ${PREFIX}/share/texmf/web2c/texmf.cnf`" ]
then
echo Seems TTF2TFMINPUTS already set in texmf.cnf, file untouched.
else
echo "% ttf2tfm data directory" >> ${PREFIX}/share/texmf/web2c/texmf.cnf
echo "TTF2TFMINPUTS = \$TEXMF/ttf2pk//" >> ${PREFIX}/share/texmf/web2c/texmf.cnf
fi
# tex/latex/CJK/Bg5/c00kai.fd
if [ -n "`grep moekai ${PREFIX}/share/texmf/tex/latex/CJK/Bg5/c00kai.fd`" ]
then
echo Seems moekai already in c00kai.fd, file untouched.
else
(cd ${PREFIX}/share/texmf/tex/latex/CJK/Bg5;
cp c00kai.fd c00kai.fd.orig;
sed -e "s/b5ka12/moekai/" c00kai.fd.orig > c00kai.fd;
)
fi
# tex/latex/CJK/Bg5/c00song.fd
if [ -n "`grep moesung ${PREFIX}/share/texmf/tex/latex/CJK/Bg5/c00song.fd`" ]
then
echo Seems moesung already in c00song.fd, file untouched.
else
(cd ${PREFIX}/share/texmf/tex/latex/CJK/Bg5;
cp c00song.fd c00song.fd.orig;
sed -e "s/CJKsub \* kai\/m\/n/CJK \* moesung/" c00song.fd.orig > c00song.fd;
mv c00song.fd c00song.fd.tmp;
sed -e "s/CJKsub \* kai\/bx\/n/CJKb \* moesung/" c00song.fd.tmp > c00song.fd;
rm c00song.fd.tmp;
)
fi
# Generate tfm fonts for moekai/moesung.
texconfig rehash # Update ls-R
mkdir -p ${VARTEXFONTS}/tfm/moe/moekai ${VARTEXFONTS}/tfm/moe/moesung
(cd ${VARTEXFONTS}/tfm/moe/moekai; ttf2tfm moe_kai -P 3 -E 4 moekai@Big5@)
(cd ${VARTEXFONTS}/tfm/moe/moesung; ttf2tfm moe_sung -P 3 -E 4 moesung@Big5@)
fi
# Update ${TEXMF} tree
texconfig rehash
# Messages to the user
echo "----------------------------------------------------------------------"
echo "CJK is now installed. Here are final notes for BIG5 users:"
echo
echo "Use 'bg5latex' instead of 'latex'. You may run 'bg5latex Big5.tex'"
echo "to check its output. CJK.doc & commands.doc are good starting"
echo "points."
if [ -z "${NOTTF}" ]
then
echo
echo "FYI, moe_kai.ttf has some characters loss. These includes:"
echo " 0xb9a6 0xbcb5 0xd974 0xdb57 0xdd7c 0xe0b5 0xe2e9 0xe351"
echo " 0xe3c4 0xe5bf 0xe5c1 0xe7ec 0xec52 0xf374 0xf6dd"
echo "But moe_sung.ttf has these all."
echo "Thanks to Clem Chuang <b5506056@csie.ntu.edu.tw> for this info."
fi
echo
echo "Happy CJKing!"
echo "----------------------------------------------------------------------"
|