updmap and kanji embedding in TeX Live

(status as of 2015-06-12)

Font selection for Japanese TeX users ((e)ptex, (e)uptex) is done at conversion time from dvi to pdf, using dvipdfmx. To this end updmap(-sys) provides ways to select whether Japanese fonts should be embedded or not, which fonts should be embedded, and which style.

The related options supported in updmap and their respective allowed values are:

For setting these options in a TeX Live installation please see the documentation of updmap. In principle you have to add it to any of the updmap.cfg files that will be read. The best method is to use updmap-sys --setoption, followed by a run with no options to regenerate what's needed:

      updmap-sys --setoption OPTION VALUE
      updmap-sys

Operation of updmap wrt kanji settings

At updmap(-sys) run time, all map file names (not the file contents!) are scanned for the strings @kanjiEmbed@ and @kanjiVariant@. If found, these strings are replaced with the values set for the respective options.

In TeX Live the following Kanji maps are defined and thus included in the updmap.cfg file:

Thus setting kanjiEmbed and kanjiVariant in a proper way one can select different font maps.

Currently shipped map files

As mentioned above, any string can be used for kanjiEmbed, but since these strings will end up in map file names, it only makes sense to use values that actually result in existing map files.

Currently, the following values for kanjiEmbed work, as the respective map files are shipped in TeX Live:

-04 maps Used font files Character collection
ms No msmincho.ttc, msgothic.ttc
ipa No ipam.ttf, ipag.ttf
ipaex No ipaexm.ttf, ipaexg.ttf
yu-win No yumin.ttf, yuminl.ttf, yugothic.ttf, yugothib.ttf
yu-osx Yes Yu{Gothic,Mincho}-{Medium,Bold}.otf
hiragino *1 HiraMinPro-{W2,W3,W6}.otf, HiraKakuPro-{W3,W6}.otf, HiraKakuStd-W8.otf, HiraMaruPro-W4.otf Adobe-Japan1-5
hiragino-pron Yes HiraMinProN-{W2,W3,W6}.otf, HiraKakuProN-{W3,W6}.otf, HiraKakuStdN-W8.otf, HiraMaruProN-W4.otf Adobe-Japan1-5
morisawa *1 A-OTF-FutoGoB101Pro-Bold.otf, A-OTF-FutoMinA101Pro-Bold.otf, A-OTF-GothicBBBPro-Medium.otf, A-OTF-Jun101Pro-Light.otf, A-OTF-MidashiGoPro-MB31.otf, A-OTF-RyuminPro-Light.otf Adobe-Japan1-4
morisawa-pr6n Yes A-OTF-FutoGoB101Pr6N-Bold.otf, A-OTF-FutoMinA101Pr6N-Bold.otf, A-OTF-GothicBBBPr6N-Medium.otf, A-OTF-Jun101Pr6N-Light.otf, A-OTF-MidashiGoPr6N-MB31.otf, A-OTF-RyuminPr6N-Light.otf Adobe-Japan1-6
kozuka *1 KozMinPro-{Light,Regular,Bold}.otf, KozGoPro-{Regular,Medium,Bold,Heavy}.otf Adobe-Japan1-4
kozuka-pr6 Yes KozMinProVI-{Light,Regular,Bold}.otf, KozGoProVI-{Regular,Medium,Bold,Heavy}.otf Adobe-Japan1-6
kozuka-pr6n Yes KozMinPr6N-{Light,Regular,Bold}.otf, KozGoPr6N-{Regular,Medium,Bold,Heavy}.otf Adobe-Japan1-6
Fonts indicated by this shape are used in [u]ptex-@kanjiEmbed@@kanjiVariant@.map.
*1: -04 maps are provided, but coverage is not complete or unknown.

To support these settings, the following map files are shipped with TeX Live in the jfontmaps package:

pTeX japanese-otf upTeX japanese-otf-uptex
JIS1990 style JIS2004 style JIS1990 style JIS2004 style
no embedding ptex-noEmbed.map ptex-noEmbed-04.map otf-noEmbed.map uptex-noEmbed.map uptex-noEmbed-04.map otf-up-noEmbed.map
MS fonts ptex-ms.map otf-ms.map uptex-ms.map otf-up-ms.map
IPA fonts ptex-ipa.map otf-ipa.map uptex-ipa.map otf-up-ipa.map
IPAex fonts ptex-ipaex.map otf-ipaex.map uptex-ipaex.map otf-up-ipaex.map
Yu Win fonts ptex-yu-win.map otf-yu-win.map uptex-yu-win.map otf-up-yu-win.map
Yu OSX fonts ptex-yu-osx.map ptex-yu-osx-04.map otf-yu-osx.map uptex-yu-osx.map uptex-yu-osx-04.map otf-up-yu-osx.map
Hiragino Pro ptex-hiragino.map ptex-hiragino-04.map otf-hiragino.map uptex-hiragino.map uptex-hiragino-04.map otf-up-hiragino.map
Hiragino ProN ptex-hiragino-pron.map ptex-hiragino-pron-04.map otf-hiragino-pron.map uptex-hiragino-pron.map uptex-hiragino-pron-04.map otf-up-hiragino-pron.map
Morisawa Pro ptex-morisawa.map ptex-morisawa-04.map otf-morisawa.map uptex-morisawa.map uptex-morisawa-04.map otf-up-morisawa.map
Morisawa Pr6N ptex-morisawa-pr6n.map ptex-morisawa-pr6n-04.map otf-morisawa-pr6n.map uptex-morisawa-pr6n.map uptex-morisawa-pr6n-04.map otf-up-morisawa-pr6n.map
Kozuka Pro ptex-kozuka.map ptex-kozuka-04.map otf-kozuka.map uptex-kozuka.map uptex-kozuka-04.map otf-up-kozuka.map
Kozuka Pr6 ptex-kozuka-pr6.map ptex-kozuka-pr6-04.map otf-kozuka-pr6.map uptex-kozuka-pr6.map uptex-kozuka-pr6-04.map otf-up-kozuka-pr6.map
Kozuka Pr6N ptex-kozuka-pr6n.map ptex-kozuka-pr6n-04.map otf-kozuka-pr6n.map uptex-kozuka-pr6n.map uptex-kozuka-pr6n-04.map otf-up-kozuka-pr6n.map

Remarks

Example of running updmap-sys

Let's suppose we want to use the Kozuka family of fonts in JIS2004 style. We thus set the respective options:

     updmap-sys --setoption kanjiEmbed kozuka
     updmap-sys --setoption kanjiVariant -04

Given the above map lines, this will effectively result in including the following map files:

  ptex-kozuka-04.map
  otf-kozuka.map
  uptex-kozuka-04.map
  otf-up-kozuka.map

Automatic setup of Kanji font embedding: kanji-config-updmap

updmap-otf was originally written by Kobayashi Taizo to automatically set up embedding of fonts with dvipdfmx according to the available fonts. Norbert Preining rewrote it in Perl, adapted it to work with the current settings of updmap.cfg, and also to avoid hard-coded paths. He is the current maintainer. The new script was called updmap-setup-kanji in TeX Live 2012, and due to Windows treating programs with 'setup' in the name specifically, is now called kanji-config-updmap. It is included in the package jfontmaps.

Usage is

 kanji-config-updmap  Set up embedding of Japanese fonts via updmap.cfg.

                This script searches for some of the most common fonts
                for embedding into pdfs by dvipdfmx.

                In addition it allows to set up arbitrary font families
                to be embedded into the generated pdf files, as long
                as at least the map file otf-<family>.map is present.
                Other map files that will be used if available are
                   
                  ptex-<family>.map
                  uptex-<family>.map
                  otf-up-<family>.map

 Please see the documentation of updmap for details (updmap --help).
 
 Usage:  kanji-config-updmap {<fontname>|auto|nofont|status}
 
    <family>    embed an arbitrary font family <family>, at least the
                map file otf-<family>.map has to be available.
    auto:       embed one of the following supported font families
                automatically:
                  hiragino, hiragino-pron, morisawa, morisawa-pr6n, 
                  kozuka, kozuka-pr6, kozuka-pr6n, ipaex, ipa, ms
                and fall back to not embedding any font if none of them
                is available
    nofont:     embed no fonts (and rely on system fonts when displaying pdfs)
                If your system does not have any of the supported font 
                families as specified above, this target is selected 
                automatically.
    status:     get information about current environment and usable font map
 
 Options:
    -n, --dry-run  do not actually run updmap
    -h, --help     show this message and exit
    -jis2004       use JIS2004 variants for default fonts of (u)pTeX
    --version      show version information and exit

The following lists values for kanjiEmbed which can be selected by kanji-config-updmap auto, in order of precedence:

  1. OpenType fonts which supports Adobe-Japan1-6
    1. morisawa-pr6n
    2. kozuka-pr6n
    3. kozuka-pr6
  2. OpenType fonts which supports Adobe-Japan1-5
    1. hiragino-pron
    2. hiragino
  3. OpenType fonts which supports Adobe-Japan1-4
    1. morisawa
    2. kozuka
  4. TrueType fonts
    1. ipaex
    2. ipa
    3. ms

The development is done in a git repository: https://git.gitorious.org/tlptexlive/jfontmaps.git.

Map file for pxdvi

updmap

Current updmap generates a file xdvi-ptex.map (in TEXMF(SYS)VAR like the other generated map files) if one sets the updmap.cfg option pxdviUse to true (see above on how to set options). In this case, xdvi-ptex.map is just a copy of kanjix.map (a map file for Japanese fonts used by dvipdfmx). Otherwise, you have to write your own xdvi-ptex.map. To summarize:

No files are removed by setting pxdviUse; so if one change pxdviUse, he has to remove the unwanted xdvi-ptex.map by hand. A copy of the original xdvi-ptex.map (included in the package pxdvi) is in texmf-dist/xdvi/xdvi-ptex.map.sample.

Syntax of xdvi-ptex.map

A map entry in xdvi-ptex.map has the following form:

<Japanese tfm> <enc> <font>[,<variant>] [<option>]

Ghostscript

The above information relates to the route tex - dvi - pdf via dvipdfmx. In case one prefers dvips and needs CJK font support for Ghostscript, please take a look at CJK fonts and Ghostscript integration.

Thanks and acknowledgements

Most of this material was taken from the wiki web site tlptexlive リポジトリ and was written by Hironori Kitagawa and Norbert Preining. Thanks goes to many contributors who helped shape the current setup.
$Date: 2015/06/11 23:16:37 $;
TUG home page; contact webmaster; (via DuckDuckGo)