summaryrefslogtreecommitdiffstats
path: root/chinese/CJK/scripts/post-install
blob: d7fffa44187194ccbf6b12ff0e2544cfa1123801 (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
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
#!/bin/sh
PATH=/bin:/usr/bin:/usr/local/bin

TEXMFMAIN=`kpsexpand '$TEXMFMAIN'`

# Some mktexpk incorrectly calls ttf2pk with -p option, delete it.
if [ ! -z "`grep "ttf2pk -p" ${PREFIX}/bin/mktexpk`" ]
then
  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
fi

# Install ttf2pk binary in ${PORTSDIR}/print/freetype, data in ${TEXMF}/ttf2pk,
# and link ${TEXMF}/ttf2tfm to ${TEXMF}/ttf2pk.
(cd ${PORTSDIR}/print/freetype/work/freetype-1.3/contrib/ttf2pk;
 ./configure --prefix=${PREFIX} --with-kpathsea-dir=${PREFIX};
 make depend all install;
 rm -fr ${TEXMFMAIN}/ttf2pk ${TEXMFMAIN}/ttf2tfm;
 cp -R data ${TEXMFMAIN}/ttf2pk;
 cd ${TEXMFMAIN}; ln -s ttf2pk ttf2tfm; )

# Install Arphic TTF fonts
mkdir -p ${TEXMFMAIN}/fonts/truetype/arphic
ln -s ${X11BASE}/lib/X11/fonts/TrueType/bkai00mp.ttf ${TEXMFMAIN}/fonts/truetype/arphic/arb5_kai.ttf
ln -s ${X11BASE}/lib/X11/fonts/TrueType/bsmi00lp.ttf ${TEXMFMAIN}/fonts/truetype/arphic/arb5_sung.ttf
ln -s ${X11BASE}/lib/X11/fonts/TrueType/gbsn00lp.ttf ${TEXMFMAIN}/fonts/truetype/arphic/argb_sung.ttf
ln -s ${X11BASE}/lib/X11/fonts/TrueType/gkai00mp.ttf ${TEXMFMAIN}/fonts/truetype/arphic/argb_kai.ttf

# fontname/special.map: add arb5kai/arb5sung/argbkai/argbsung entries.
if [ -n "`grep arb5kai ${TEXMFMAIN}/fontname/special.map`" ]
then
  echo Seems arb5kai already in special.map, file untouched.
else
  echo "@c Arphic BIG5 Kaiti TTF" >> ${TEXMFMAIN}/fontname/special.map
  echo "arb5kai		big5		arb5kai" >> ${TEXMFMAIN}/fontname/special.map
fi
if [ -n "`grep arb5sung ${TEXMFMAIN}/fontname/special.map`" ]
then
  echo Seems arb5sung already in special.map, file untouched.
else
  echo "@c Arphic BIG5 Mingti TTF" >> ${TEXMFMAIN}/fontname/special.map
  echo "arb5sung		big5		arb5sung" >> ${TEXMFMAIN}/fontname/special.map
fi
if [ -n "`grep argbkai ${TEXMFMAIN}/fontname/special.map`" ]
then
  echo Seems argbkai already in special.map, file untouched.
else
  echo "@c Arphic GB Kaiti TTF" >> ${TEXMFMAIN}/fontname/special.map
  echo "argbkai		gb		argbkai" >> ${TEXMFMAIN}/fontname/special.map
fi
if [ -n "`grep argbsung ${TEXMFMAIN}/fontname/special.map`" ]
then
  echo Seems argbsung already in special.map, file untouched.
else
  echo "@c Arphic GB Sungti TTF" >> ${TEXMFMAIN}/fontname/special.map
  echo "argbsung		gb		argbsung" >> ${TEXMFMAIN}/fontname/special.map
fi

# ttf2pk/ttfonts.map: add arb5kai/arb5sung/argbkai/argbsung entries.
if [ -n "`grep arb5kai ${TEXMFMAIN}/ttf2pk/ttfonts.map`" ]
then
  echo Seems arb5kai already in ttfonts.map, file untouched.
else
  echo "arb5kai@UBig5@   arb5_kai Pid=3 Eid=1" >> ${TEXMFMAIN}/ttf2pk/ttfonts.map
fi
if [ -n "`grep arb5sung ${TEXMFMAIN}/ttf2pk/ttfonts.map`" ]
then
  echo Seems arb5sung already in ttfonts.map, file untouched.
else
  echo "arb5sung@UBig5@   arb5_sung Pid=3 Eid=1" >> ${TEXMFMAIN}/ttf2pk/ttfonts.map
fi
if [ -n "`grep argbkai ${TEXMFMAIN}/ttf2pk/ttfonts.map`" ]
then
  echo Seems argbkai already in ttfonts.map, file untouched.
else
  echo "argbkai@UGB@   argb_kai Pid=3 Eid=1" >> ${TEXMFMAIN}/ttf2pk/ttfonts.map
fi
if [ -n "`grep argbsung ${TEXMFMAIN}/ttf2pk/ttfonts.map`" ]
then
  echo Seems argbsung already in ttfonts.map, file untouched.
else
  echo "argbsung@UGB@   argb_sung Pid=3 Eid=1" >> ${TEXMFMAIN}/ttf2pk/ttfonts.map
fi

# ttf2pk/UBig5.sfd: apply patch to support Eten's extention
(cd ${TEXMFMAIN}/ttf2pk;
 patch < ${FILESDIR}/UBig5.sfd.diff;
 rm -f UBig5.sfd.orig; )

# web2c/texmf.cnf
if [ -n "`grep TTF2PKINPUTS ${TEXMFMAIN}/web2c/texmf.cnf`" ]
then
  echo Seems TTF2PKINPUTS already set in texmf.cnf, file untouched.
else
  echo "% ttf2pk data directory" >> ${TEXMFMAIN}/web2c/texmf.cnf
  echo "TTF2PKINPUTS = \$TEXMF/ttf2pk//" >> ${TEXMFMAIN}/web2c/texmf.cnf
fi
if [ -n "`grep TTF2TFMINPUTS ${TEXMFMAIN}/web2c/texmf.cnf`" ]
then
  echo Seems TTF2TFMINPUTS already set in texmf.cnf, file untouched.
else
  echo "% ttf2tfm data directory" >> ${TEXMFMAIN}/web2c/texmf.cnf
  echo "TTF2TFMINPUTS = \$TEXMF/ttf2tfm//" >> ${TEXMFMAIN}/web2c/texmf.cnf
fi

# Clean redundant files created during patch phase.
rm -f ${TEXMFMAIN}/tex/latex/CJK/Bg5/c00kai.fd.orig
rm -f ${TEXMFMAIN}/tex/latex/CJK/Bg5/c00song.fd.orig
rm -f ${TEXMFMAIN}/tex/latex/CJK/GB/c10kai.fd.orig
rm -f ${TEXMFMAIN}/tex/latex/CJK/GB/c10song.fd.orig

# Generate tfm fonts for Arphic TTFs.
rm -fr ${TEXMFMAIN}/fonts/tfm/arphic/arb5kai
rm -fr ${TEXMFMAIN}/fonts/tfm/arphic/arb5sung
rm -fr ${TEXMFMAIN}/fonts/tfm/arphic/argbkai
rm -fr ${TEXMFMAIN}/fonts/tfm/arphic/argbsung
mkdir -p ${TEXMFMAIN}/fonts/tfm/arphic/arb5kai ${TEXMFMAIN}/fonts/tfm/arphic/arb5sung ${TEXMFMAIN}/fonts/tfm/arphic/argbkai ${TEXMFMAIN}/fonts/tfm/arphic/argbsung
(cd ${TEXMFMAIN}/fonts/tfm/arphic/arb5kai; ttf2tfm ${TEXMFMAIN}/fonts/truetype/arphic/arb5_kai -P 3 -E 1 arb5kai@${TEXMFMAIN}/ttf2pk/UBig5@)
(cd ${TEXMFMAIN}/fonts/tfm/arphic/arb5sung; ttf2tfm ${TEXMFMAIN}/fonts/truetype/arphic/arb5_sung -P 3 -E 1 arb5sung@${TEXMFMAIN}/ttf2pk/UBig5@)
(cd ${TEXMFMAIN}/fonts/tfm/arphic/argbkai; ttf2tfm ${TEXMFMAIN}/fonts/truetype/arphic/argb_kai -P 3 -E 1 argbkai@${TEXMFMAIN}/ttf2pk/UGB@)
(cd ${TEXMFMAIN}/fonts/tfm/arphic/argbsung; ttf2tfm ${TEXMFMAIN}/fonts/truetype/arphic/argb_sung -P 3 -E 1 argbsung@${TEXMFMAIN}/ttf2pk/UGB@)

# Update ls-R
texconfig rehash

# Messages to the user
echo "-------------------------------------------------------------------------"
echo "CJK is now installed. You may use bg5latex or gbklatex wrt"
echo "BIG5 or GB encodings."
echo
echo If you want to install other TTF fonts, you have to manually edit:
echo  ${TEXMFMAIN}/fontname/special.map
echo  ${TEXMFMAIN}/ttf2pk/ttfonts.map
echo  ${TEXMFMAIN}/web2c/texmf.cnf
echo  ${TEXMFMAIN}/tex/latex/CJK/Bg5/c00kai.fd and
echo   ${TEXMFMAIN}/tex/latex/CJK/GB/c10kai.fd, for Kai family fonts.
echo  ${TEXMFMAIN}/tex/latex/CJK/Bg5/c00song.fd and
echo   ${TEXMFMAIN}/tex/latex/CJK/GB/c10song.fd, for Sung family fonts.
echo Then use ttf2tfm to generate corresponding tfm fonts.
echo
echo "Happy CJKing!"
echo "-------------------------------------------------------------------------"
OpenPOWER on IntegriCloud