Saturday, April 13, 2013

Texlive and CJK

  1. suppose texlive and CJK is installed correctly
  2. install fontforge
    sudo apt-get install fontforge
    
  3. download font.tar.bz2
  4. prepare font song.ttc, and generate font files
    fontforge -script subfonts.pe simsun.ttc song Unicode.sfd
    
  5. create bash script makemap.sh, run the script to generate map file
    if [ -f song.map ]; then
        rm song.map
    fi
    for i in *.tfm
    do
        echo "${i%.tfm} ${i%.tfm} <${i%.tfm}.pfb" >> song.map
    done
    
  6. create c70song.fd
    % This is c70song.fd for CJK package.
    % created by Edward G.J. Lee
    % modify by Yue Wang
    \ProvidesFile{c70song.fd}
    \DeclareFontFamily{C70}{song}{\hyphenchar \font\m@ne}
    \DeclareFontShape{C70}{song}{m}{n}{<-> CJK * song}{}
    \DeclareFontShape{C70}{song}{bx}{n}{<-> CJKb * song}{\CJKbold}
    \endinput
    
  7. check system conf file location
    kpsewhich texmf.cnf
    
  8. change TEXMFHOME to
    TEXMFHOME = $HOME/texmf
    
  9. change TEXMFDBS to
    TEXMFDBS = $TEXMFHOME;$TEXMFLOCAL;$TEXMFMAIN;$VARTEXFONTS;$TEXMFSYSVAR;$TEXMFDIST
    
  10. mimic texmf tree and copy fonts and configs. texmf should match those in TEXMFHOME
    mkdir -p ~/texmf/fonts/map/dvips/CJK
    mkdir -p ~/texmf/fonts/tfm/CJK/song
    mkdir -p ~/texmf/fonts/type1/CJK/song
    mkdir -p ~/texmf/tex/latex/CJK/UTF8
    
    cp song.map   ~/texmf/fonts/map/dvips/CJK
    cp *.tfm      ~/texmf/fonts/tfm/CJK/song
    cp *.pfb      ~/texmf/fonts/type1/CJK/song
    cp c70song.fd ~/texmf/tex/latex/CJK/UTF8
    
  11. update system conf
    sudo texhash
    updmap
    
  12. in $HOME/texmf/fonts/map/pdftex/updmap/pdftex.map, append content in song.map

No comments:

Post a Comment