aboutsummaryrefslogblamecommitdiff
path: root/print/latex-cjk/scripts/post-install
blob: 01efc32732bda2cc687886640b4d389fdc71cf47 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
         

                                 

                                  
                                                                  





                                                                                
 
                                                             
 
                                                                      
                                        
    

                                                            

                                                                 
  
                                         
    
                                                             
    

                                                                          
  
                                        
    
                                                            
    

                                                                 
  
                                         
    
                                                             
    

                                                                          
  
 

                                                                    
    
                                                            
    
                                                                                 
  
                                                           
    
                                                             
    
                                                                                   
  
                                                          
    
                                                            
    
                                                                               
  
                                                           
    
                                                             
    
                                                                                 
  
 

                                                            
    
                                                                   
    

                                                                        
  
                                                             
    
                                                                    
    

                                                                          
  
 




                                                    
 
                                     



                                             




                                                                                                                                                                  
 
             


                      


                                                                                
    








                                                                       

                    
                                                                                
#!/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

SPECIALMAP="${TEXMFMAIN}-dist/fonts/map/fontname/special.map"

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

# 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 "-------------------------------------------------------------------------"