Jan Poland  →  Japan  →  Fonts
 

Japanese Fonts and (CJK-)LaTeX

Here are my quick recipes for typesetting Japanese with LaTeX. This is primarily intended for LaTeX users who (like me) do not know too much about how TeX handles fonts, and who find it hard to read instructions in Japanese. If you (are an expert and) find errors in this page, please let me know - thanks!

Quick navigation:

Although there are many Japanese LaTeX users, it is not a completely trivial to set up a LaTeX environment for Japanese typesetting, in particular if you would like to obtain optically acceptable results. This is due to several reasons:

  1. Most Japanese use Japanese LaTeX (pLaTeX). This is difficult to handle for non-Japanese, as instructions is usually in Japanese. In contrast, I will describe how to install fonts to CJK-LaTeX, which is just an extension of (standard) LaTeX. In this way, you can continue to use your LaTeX environment without modification.
  2. Even for CJK-LaTeX, much information is available in Japanese only.
  3. As Asian fonts are complex and costly to produce, only few of them are freely available (see also this page).
  4. Non-Japanese are not used to reading Kanji. Some free Japanese fonts (such as Wadalab and Kochi) look clumsy and poorly balanced to Japanese, where a non-Japanese hardly can tell the difference. Most Japanese use and are accustomed to the Microsoft fonts, which are however not legally usable with LaTeX, in particular on non-Windows systems.

Here, I describe how to set up two free Japanese fonts for CJK-LaTeX. Collections of (partly non-free) Japanese TrueType fonts can be found here (free fonts) and here (larger collection).

I suppose you already have installed CJK-LaTeX. In many common TeX environments installation is very easy, for instance tetex coming with SuSE Linux (use yast) or MikTeX (use the update wizard).

I also assume that you can write Japanese text in some way, e.g. with your editor. There are numerous web sites which provide good help with this if you need.

Finally, I assume that you are familiar enough with TeX/LaTeX to install new packages and things. In particular, you should know what (and where) the texmf and localtexmf directory trees are.

Kanji48

One old but relatively good Japanese font available is "Kanji48". It is a 48 by 48 pixel bitmap font for LaTeX, so probably not suited very well for magnification. It is public domain, so there are no license problems. Kanji48 sometimes comes pre-installed together with CJK, but then sometimes is not installed correctly. Therefore I have bundled a downloadable archive. Just unpack it to your texmf (or, safer, localtexmf), and refresh your LaTeX filename data base (e.g. under Unix by running texhash, or with MixTeX by starting MikTeX options and clicking on the "refresh file name database" button). Then you can test the installation by LaTeXing the following example:

\documentclass{article}
\usepackage{CJK}
\begin{document}
\begin{CJK}{JIS}{song}
<EUC coded Japanese input>
\end{CJK}
\end{document}


A short note on coding. Since there are far more than 256 characters in Japanese, coding needs more than one byte. Unfortunately, there is no agreed-upon coding standard, but a couple of them are commonly used, including JIS, SJIS, EUC, and UTF8 (the latter is unicode). For CJK-LaTeX, you usually have to use either EUC or UTF8 (and don't ask me why in the case of EUC, the font encoding switch of the CJK environment is set to JIS).

TrueType fonts, in particular the IPA fonts

As most Japanese use Windows, most fonts available are TrueType. It is not too difficult to set up a TrueType font for LaTeX. I will describe this for the IPA fonts, which can be downloaded at this web site as a part of the Common Open Printing System. According to Japanese colleagues, the IPA font is of good optical quality. There are four fonts - IPA Mincho and Gothic, fixed and variable width - in the package. The following steps are necessary to set up the IPA Mincho fixed width font, all other fonts are installed analogously.
  1. First we need to create tfm (TeX font metric) files. A tool called ttf2tfm is usually part of your LaTeX distribution (originally from the Freetype project). (If not, get it from the web or directly download the tfm files from this site.) Execute the following command
    ttf2tfm ipam.ttf ipam@UJIS@
    if you want to use EUC coding later, and
    ttf2tfm ipam.ttf ipam-uni@Unicode@
    if you want to use UTF8. (Be careful with proper capitalization. If the command fails on your system, you might need to change capitalization, e.g. unicode instead of Unicode.) Alternatively, download all tfm files here.
  2. Place the tfm files in some directory under texmf/fonts/tfm (e.g. texmf/fonts/tfm/IPA), where texmf refers to your texmf or localtexmf tree.
  3. Place ipam.ttf (which you have downloaded as a part of the Common Open Printing System) in texmf/fonts/truetype or a subdirectory. (Again, texmf refers to your texmf or localtexmf tree.)
  4. Next, we have to set up fd (font definition) files. I prepared them for download. But if you want to do it by yourself, in the case of EUC, create a file named C40ipam.fd (and similarly for the other fonts) with the following contents
    \DeclareFontFamily{C40}{ipam}{\hyphenchar \font\m@ne}
    \DeclareFontShape{C40}{ipam}{m}{n}{<-> CJK * ipam}{}
    \DeclareFontShape{C40}{ipam}{bx}{n}{<-> CJKb * ipam}{\CJKbold}

    If you want to use unicode in addition or instead, the file should be named C70ipam.fd and contain
    \DeclareFontFamily{C70}{ipam}{\hyphenchar \font\m@ne}
    \DeclareFontShape{C70}{ipam}{m}{n}{<-> CJK * ipam-uni}{}
    \DeclareFontShape{C70}{ipam}{bx}{n}{<-> CJKb * ipam-uni}{\CJKbold}

    Place these files somewhere LaTeX finds them, e.g. in a subdirectory of texmf/tex/latex
  5. Locate the file ttfonts.map on your system. Make sure that this file contains the line
    ipam@UJIS@ ipam.ttf
    in case of EUC, and/or, for unicode,
    ipam-uni@Unicode@ ipam.ttf
    (Do this similarly for all other fonts.)
  6. Refresh your LaTeX filename data base (e.g. under Unix by running texhash, or with MixTeX by starting MikTeX options and clicking on the "refresh file name database" button).
  7. Finally test your installation with something like the following

    \documentclass{article}
    \usepackage{CJK}
    \begin{document}
    \begin{CJK}{JIS}{ipam}
    <EUC coded Japanese input>
    \end{CJK}
    \end{document}


    in case of EUC coding, for unicode replace \begin{CJK}{JIS}{ipam} by \begin{CJK}{UTF8}{ipam} (and of course use unicode input).

Hints thanks to Thomas Zeugmann:

  • Please make sure that ttf2pk is installed (this is, like ttf2tfm, a tool from the Freetype project). Otherwise the necessary PK files cannot be generated.
  • If you want automatic PK file creation when using PdfLaTeX, you need to locate the texmf/web2c/texmf.cnf configuration file and make sure it contains the line
    MKTEXPK = 1

Remark: You should be able to install any TrueType font to LaTeX in this way. Note that it is not allowed to use the Microsoft fonts MSMincho and MSGothic on non-Microsoft systems.

Recall that not all (free) fonts you may be able to get look good to a Japanese, even if you cannot tell the difference! Examples for poor looking fonts are Wadalab, Kochi and Sazanami. On the other hand, Cyberbit and GT2000 seem optically okay. Note that Cyberbit is no longer freely provided by the manufacturer, but seems to be freely usable. It still can be found at various places in the internet.

Downloads

Here is a summary of all downloads from this site:

Links

Here is a summary of all links from this site:
 
 
Last update: Fri Mar 9 05:09:33 2007 GMT by Jan Poland, Page = "Fonts"