updmap and kanji embedding in TeX Live

Font selection for CJK 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 CJK 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 @xxEmbed@ (with the same options for xx as above) and @jaVariant@. If found, these strings are replaced with the values set for the respective options.

In TeX Live, several replacement maps are defined in the packages ptex, uptex, and japanese-otf.

Currently shipped map files

The list of currently supported font sets is changing, and the latest state can be checked in the README file of the ptex-fontmaps package.

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 jaEmbed kozuka
     updmap-sys --setoption jaVariant -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 ptex-fontmaps.

Usage is

  kanji-config-updmap 20210625.0
  Set up embedding of Japanese/Chinese/Korean 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 representative map file is present.
    Other map files will be used if available:

      For Japanese:
        ptex-<family>map (representative map file)
        uptex-<family>map
        otf-<family>map
        otf-up-<family>map

      For Simplified Chinese, Traditional Chinese and Korean:
        uptex-<NN><family>map (representative map file)
        otf-<NN><family>map
       (NN being: sc, tc, ko)

  Please see the documentation of updmap for details (updmap --help).

  Usage:  kanji-config-updmap [OPTION] {<family>|auto|nofont|status}

     <family>    Embed an arbitrary font family <family> at least
                 the representative map file has to be available.
     auto:       If the current status is noEmbed or unknown, try to embed
                 one of the supported font families automatically.
                 If none of them is available, fall back to nofont
     nofont:     Embed no fonts (and rely on system fonts when displaying pdfs).
                 If your system does not have any of the supported font
                 families, this target is selected automatically.
     status:     Get information about current environment and usable font maps.

  Options:
    -n, --dry-run  Do not actually run updmap
    -h, --help     Show this message and exit
    --mode=NN      Setup for Japanese (NN=ja), Korean (NN=ko),
                   Simplified Chinese (NN=sc), Traditional Chinese (NN=tc)
    --NN           Shorthand for --mode=NN
    --jis2004      Use JIS2004 variants for default fonts of (u)pTeX
    --sys          Run in sys mode, i.e., call updmap -sys
    --user         Run in user mode, i.e., call updmap -user or updmap,
                   by checking the version of the updmap script.
                   If a non-parsable output of `updmap --version' is found,
                   a new updmap with --user option is assumed.
                   If this is not the case, explicitly use --old.
    --old          Makes kanji-config-updmap call `updmap' without --user argument in user mode.
    --force        Set up font embedding even if the font is not available.
    --version      Show version information and exit

The development is done within the Japanese TeX Development Community in the project https://github.com/texjporg/ptex-fontmaps.

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 and the Github project Configuring Ghostscript for CJK CID/TTF fonts.

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: 2024/03/13 22:47:17 $;
TUG home page; webmaster; facebook; twitter; mastodon;   (via DuckDuckGo)