2

I'm compiling a Japanese TeX file written with CJK.sty, and using the IPA fonts. I used ttf2tfm to generate tfm files. Is there a way to tell pdftex that a set of tfm files correspond to one Unicode truetype fonts, directly from inside a tex file? I'm currently using

\pdfmapfile{+ipamp.map}

with the ipamp.map file of the form

ipamp00 <ipamp.ttf <ipamp00.enc
ipamp01 <ipamp.ttf <ipamp01.enc
ipamp02 <ipamp.ttf <ipamp02.enc
ipamp03 <ipamp.ttf <ipamp03.enc
... continuing to ipampff ...

which, I think, is rather stupid. Furthermore, the embedding of the fonts to the pdf file, which is done at the last stage of pdftex, is very slow. My question then is if there's a better way. For example, for dvipdfmx, you can just have one line

ipamp@Unicode@ unicode ipamp.ttf

Background: I'm preparing a Japanese TeX file for submission to a preprint server (arXiv) which doesn't unfortunately accept XeTeX or LuaTeX. The server only has the wadalab font for Japanese, which is rather ugly. So I'd like to use IPA instead. The way I described above works, but doesn't sound perfect.

3

pdfTeX now supports one-line mapping syntax using a SFD file. It is undocumented. You can use

ipamp@Unicode@  <ipamp.ttf

instead of

ipamp00 <ipamp.ttf <ipamp00.enc
ipamp01 <ipamp.ttf <ipamp01.enc
ipamp02 <ipamp.ttf <ipamp02.enc
ipamp03 <ipamp.ttf <ipamp03.enc
......

And you can even use

\pdfmapline{=ipamp@Unicode@  <ipamp.ttf}

in your TeX file. Then you don't need to write a mapfile.

This method is used for Chinese years ago. You can have a look at zhwinfonts.tex in our zhmetrics bundle.


Full test for those who are not familar with CJK and CJK fonts:

  1. Download IPA Fonts from http://sourceforge.jp/projects/ipafonts/releases/

  2. Use this command line to make a lot of .tfm files:

    ttf2tfm ipamp.ttf -q -w ipamp@Unicode@
    

    and we have this map line on console:

    ipamp@Unicode@   ipamp.ttf
    
  3. Write a c70ipamp.fd to install the font in LaTeX NFSS:

    \DeclareFontFamily{C70}{ipamp}{\hyphenchar \font\m@ne}
    
    \DeclareFontShape{C70}{ipamp}{m}{n}{<-> CJK * ipamp}{\CJKnormal}
    \DeclareFontShape{C70}{ipamp}{bx}{n}{<-> CJKb * ipamp}{\CJKbold}
    
  4. Use this TeX file to test (UTF-8 encoded, compiled with pdflatex):

    \documentclass{article}
    \AtBeginDvi{\pdfmapline{=ipamp@Unicode@  <ipamp.ttf}}
    \usepackage{CJK}
    \begin{document}
    \begin{CJK*}{UTF8}{ipamp}
    日本語
    \clearpage\end{CJK*}
    \end{document}
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.