星期六, 十二月 06, 2008
星期四, 十二月 04, 2008
A complete bash script
Can be downloaded @
http://bioinfo.sdau.edu.cn/rsc/texfonts/icjk.sh
To be garrulous again, collecting truetype files is your own business, thought there are plenty of free true type files on the web (e.g. ftp://ftp.netscape.com/pub/communicator/extras/fonts/windows/Cyberbit.ZIP [Remember to name it cyberb.ttf]!).
My script is for fresh installation only. If you are to install fonts separately, please modify the script where necessary.
Just noticed my stamped date is tomorrow, but I won't change it any more.
http://bioinfo.sdau.edu.cn/rsc/texfonts/icjk.sh
To be garrulous again, collecting truetype files is your own business, thought there are plenty of free true type files on the web (e.g. ftp://ftp.netscape.com/pub/communicator/extras/fonts/windows/Cyberbit.ZIP [Remember to name it cyberb.ttf]!).
My script is for fresh installation only. If you are to install fonts separately, please modify the script where necessary.
Just noticed my stamped date is tomorrow, but I won't change it any more.
Revised configure CJK on Fedora 10
Prepare:
Create a script file pre.sh:
$ chmod +x pre.sh
$ su -c ./pre.sh
Get fonts:
Copy all the ttf/ttc file to /usr/share/texmf/fonts/truetype/
Rename them all in lower cased file names
Install fonts:
Content of the script file icjk.sh:
$ su -c ./icjk.sh
$ updmap
Enjoy!
Create a script file pre.sh:
#!/usr/bin/env bash
yum install texlive-afm texlive-texmf-afm fontforge -y
cd /usr/share/texmf/fonts/truetype/
wget http://cjk.ffii.org/cjk-4.8.1.tar.gz
wget http://cjk.ffii.org/cjk-4.8.1-doc.tar.gz
tar zxvf cjk-4.8.1.tar.gz
tar zxvf cjk-4.8.1-doc.tar.gz
mv cjk-4.8.1 /usr/share/texmf/tex/latex/cjk
rm *gz
$ chmod +x pre.sh
$ su -c ./pre.sh
Get fonts:
Copy all the ttf/ttc file to /usr/share/texmf/fonts/truetype/
Rename them all in lower cased file names
Install fonts:
Content of the script file icjk.sh:
#!/usr/bin/env bash
############################################################
# This bash script install windows or whatever ttf fonts
# on to Fedora 10 or alike.
#
# Useage
# 1) Use script pre.sh (refer relative descriptions)
#
# 2) Copy all ttf and this script files to directory,
# for example, /tmp/ttf/
# Then in that directory, run the following
# su -c ./icjk.sh
#
# ----------------------------------------------------------
# Don't know how to install ttc file
#
# ----------------------------------------------------------
# Don't forget to run
# updmap
# in your own right, i.e. not with root privilege
#
# ----------------------------------------------------------
# Write by Xijiang Yu
# Dec. 5. 2008
############################################################
############################################################
# Necessary path/file names
# you can name the path 'winfonts' to whatever you want
############################################################
texmf=/usr/share/texmf
fonts=${texmf}/fonts
pname=winfonts
pfb=${fonts}/type1/${pname}
afm=${fonts}/afm/${pname}
tfm=${fonts}/tfm/${pname}
enc=${fonts}/enc/${pname}
psd=${fonts}/map/dvips/${pname}
map=${fonts}/map/${pname}
cid=${fonts}/map/dvipdfm/cid-x.map
utf=${texmf}/tex/latex/cjk/utf8
if ! [ -a $map ]
then
mkdir -p $map
fi
if ! [ -a $psd ]
then
mkdir -p $psd
fi
if ! [ -a $psd ]
then
mkdir -p $utf
fi
wget http://delloye.free.fr/Unicode.sfd
cp /usr/share/texmf/tex/latex/cjk/utils/subfonts/subfonts.pe .
for i in *.ttf
do
fontforge -script subfonts.pe $i ${i%.*} Unicode.sfd
for j in *.tfm # Create *ps.map
do
echo ${j%.tfm} ${j%.tfm} \<${j%.tfm}.pfb >> ${i%.*}ps.map
done
for j in *.enc # Create *.map
do
echo ${j%.enc} \<$i \<$j >>${i%.*}.map
done
mkdir -p ${fonts}/{type1,afm,tfm,enc}/${pname}/${i%.*}
# move the fontforge created files to proper places
mv *.pfb ${pfb}/${i%.*}
mv *.afm ${afm}/${i%.*}
mv *.tfm ${tfm}/${i%.*}
mv *.enc ${enc}/${i%.*}
mv ${i%.*}ps.map $psd
mv ${i%.*}.map $map
echo ${i%.*}@Unicode@ Identity-H :0:${i} >>${cid}
echo Map ${i%.*}.map >>${texmf}/web2c/updmap.cfg
echo f ${i%.*}.map >>${texmf}/dvipdfm/config/config
echo p +${i%.*}ps.map >>${texmf}/dvips/config/config.ps
# Create c70*.fd file
echo \\ProvidesFile{c70${i%.*}.fd} >>${utf}/c70${i%.*}.fd
echo \\DeclareFontFamily{C70}{${i%.*}}{\\hyphenchar \\font\\m@ne} >>${utf}/c70${i%.*}.fd
echo "\\DeclareFontShape{C70}{${i%.*}}{m}{n}{<-> CJK * ${i%.*}}{}" >>${utf}/c70${i%.*}.fd
echo "\\DeclareFontShape{C70}{${i%.*}}{bx}{n}{<-> CJKb * ${i%.*}}{\CJKbold}" >>${utf}/c70${i%.*}.fd
echo \\endinput >>${utf}/c70${i%.*}.fd
cp $i ${fonts}/truetype
done
mktexlsr
$ su -c ./icjk.sh
$ updmap
Enjoy!
Configure CJK on Fedora 10
Check your texlive installation list:
$ rpm -qa |grep texlive
Typically, if you installed default texlive:
# yum install texlive-afm texlive-texmf-afm fontforge -y
# cd /usr/share/texmf/fonts/truetype/
# wget http://cjk.ffii.org/cjk-4.8.1.tar.gz
# wget http://cjk.ffii.org/cjk-4.8.1-doc.tar.gz
# tar zxvf cjk-4.8.1.tar.gz
# tar zxvf cjk-4.8.1-doc.tar.gz
# mv cjk-4.8.1 /usr/share/texmf/tex/latex/cjk
# rm *gz
# cp [from somewhere] simfang.ttf [for example] .
# wget http://delloye.free.fr/Unicode.sfd
# cp /usr/share/texmf/tex/latex/cjk/utils/subfonts/subfonts.pe .
# time fontforge -script subfonts.pe simfang.ttf simfang Unicode.sfd
Create the following two shell script files:
mkpsmap:
mkmap:
# chmod +x mkmap mkpsmap
# ./mkmap; ./mkpsmap
# mkdir -p
# mkdir -p /usr/share/texmf/fonts/map/winfonts /usr/share/texmf/fonts/map/dvips/winfonts /usr/share/texmf/tex/latex/cjk/utf8/
# mv *.pfb /usr/share/texmf/fonts/type1/winfonts/simfang
# mv *.afm /usr/share/texmf/fonts/afm/winfonts/simfang
# mv *.tfm /usr/share/texmf/fonts/tfm/winfonts/simfang
# mv *.enc /usr/share/texmf/fonts/enc/winfonts/simfang
# mv simfangps.map /usr/share/texmf/fonts/map/dvips/winfonts
# mv simfang.map /usr/share/texmf/fonts/map/winfonts
# echo simfang@Unicode@ Identity-H :0:simfang.ttf >>/usr/share/texmf/fonts/map/dvipdfm/cid-x.map
# echo Map simfang.map >>/usr/share/texmf/web2c/updmap.cfg
# echo f simfang.map >>/usr/share/texmf/dvipdfm/config/config
# echo p +simfangps.map >>/usr/share/texmf/dvips/config/config.ps
In /usr/share/texmf/tex/latex/cjk/utf8/ create file c70simfang.fd with content:
# mktexlsr
# exit
$ updmap
Now let's enjoy:
$ mkdir /tmp/test
$ cd /tmp/test
Create file test.tex:
$ pdflatex test
$ rpm -qa |grep texlive
texlive-utils-2007-35.fc10.x86_64
texlive-texmf-errata-2007-4.fc9.noarch
texlive-texmf-latex-2007-26.fc10.noarch
texlive-texmf-errata-afm-2007-4.fc9.noarch
texlive-texmf-2007-26.fc10.noarch
texlive-texmf-fonts-2007-26.fc10.noarch
texlive-2007-35.fc10.x86_64
texlive-latex-2007-35.fc10.x86_64
texlive-afm-2007-35.fc10.x86_64
texlive-texmf-errata-dvips-2007-4.fc9.noarch
texlive-texmf-errata-fonts-2007-4.fc9.noarch
texlive-dvips-2007-35.fc10.x86_64
texlive-texmf-dvips-2007-26.fc10.noarch
texlive-texmf-east-asian-2007-26.fc10.noarch
texlive-texmf-errata-latex-2007-4.fc9.noarch
texlive-texmf-afm-2007-26.fc10.noarch
Typically, if you installed default texlive:
# yum install texlive-afm texlive-texmf-afm fontforge -y
# cd /usr/share/texmf/fonts/truetype/
# wget http://cjk.ffii.org/cjk-4.8.1.tar.gz
# wget http://cjk.ffii.org/cjk-4.8.1-doc.tar.gz
# tar zxvf cjk-4.8.1.tar.gz
# tar zxvf cjk-4.8.1-doc.tar.gz
# mv cjk-4.8.1 /usr/share/texmf/tex/latex/cjk
# rm *gz
# cp [from somewhere] simfang.ttf [for example] .
# wget http://delloye.free.fr/Unicode.sfd
# cp /usr/share/texmf/tex/latex/cjk/utils/subfonts/subfonts.pe .
# time fontforge -script subfonts.pe simfang.ttf simfang Unicode.sfd
Create the following two shell script files:
mkpsmap:
for i in *.tfm
do
cat >> simfangps.map <<EOF
${i%.tfm} ${i%.tfm} <${i%.tfm}.pfb
EOF
done
mkmap:
for i in *.enc
do
cat >>simfang.map <<EOF
${i%.enc} <simfang.ttf <$i
EOF
done
# chmod +x mkmap mkpsmap
# ./mkmap; ./mkpsmap
# mkdir -p
/usr/share/texmf/fonts/{type1,afm,tfm,enc}/winfonts/simfang
# mkdir -p /usr/share/texmf/fonts/map/winfonts /usr/share/texmf/fonts/map/dvips/winfonts /usr/share/texmf/tex/latex/cjk/utf8/
# mv *.pfb /usr/share/texmf/fonts/type1/winfonts/simfang
# mv *.afm /usr/share/texmf/fonts/afm/winfonts/simfang
# mv *.tfm /usr/share/texmf/fonts/tfm/winfonts/simfang
# mv *.enc /usr/share/texmf/fonts/enc/winfonts/simfang
# mv simfangps.map /usr/share/texmf/fonts/map/dvips/winfonts
# mv simfang.map /usr/share/texmf/fonts/map/winfonts
# echo simfang@Unicode@ Identity-H :0:simfang.ttf >>/usr/share/texmf/fonts/map/dvipdfm/cid-x.map
# echo Map simfang.map >>/usr/share/texmf/web2c/updmap.cfg
# echo f simfang.map >>/usr/share/texmf/dvipdfm/config/config
# echo p +simfangps.map >>/usr/share/texmf/dvips/config/config.ps
In /usr/share/texmf/tex/latex/cjk/utf8/ create file c70simfang.fd with content:
% This is c70simfang.fd for CJK package.
% created by Edward G.J. Lee
% modify by Yue Wang & Xijiang
\ProvidesFile{c70simfang.fd}
\DeclareFontFamily{C70}{simfang}{\hyphenchar \font\m@ne}
\DeclareFontShape{C70}{simfang}{m}{n}{<-> CJK * simfang}{}
\DeclareFontShape{C70}{simfang}{bx}{n}{<-> CJKb * simfang}{\CJKbold}
\endinput
# mktexlsr
# exit
$ updmap
Now let's enjoy:
$ mkdir /tmp/test
$ cd /tmp/test
Create file test.tex:
\documentclass{article}
嗨,有谁愿意把这一大段命令写成 shell/perl script 么?
\usepackage{CJK}
\begin{document}
\begin{CJK}{UTF8}{simfang}
\end{CJK}
\end{document}
$ pdflatex test
订阅:
博文 (Atom)