next up previous contents index
Next: GhostScript and Wada Fonts Up: Japanese Printing and Text Previous: GhostScript


The Steve Turnbull Guide to TeX and Ghostscript

contributed by Steve Turnbull
Edited by Craig Oda

Wed, 16 Oct 96 22:42 JST

OK, for all you folks who wish you had a Japanese TeX you could integrate with Ghostscript, here's the short synopsis. I dunno when I'll get around to writing up the whole thing in accurate detail with config files. Sorry, but I left the apartment today at 8:00am and tomorrow will start just as early and go just as late....

Get a recent Ghostscript

you want the Aladdin 4.03 version. Stay away from Aladdin 4.0[12]?, they have bugs in garbage collection that make kanji (and anything big, for that matter) painful.*.4.03*


This includes fonts and other stuff you don't need if you've got Ghostscript already; there may be closer mirrors, too.

Get the Wadalab fonts




These are *big*, like multiple megabytes per gzipped font. You *need* the programs in the tools directory, but you can pick and choose the fonts. You must get the symbol font, though; it's used in combination with all the others.

Build Ghostscript and the Wadalab tools

especially wftodm. Install the fonts in a reasonable place, $KANJI in the sequel. Don't forget the symbol fonts, wadalab-symbol-6.tar.gz.

Get and build NTT-JTeX

You don't really need either of the last two, but either one has the latest version of Karl Berry's kpathsea library that I've been able to find. It makes life easier if all your utilities use the same library and config files, I've found; may as well be up to date. I don't know to what extent xdvik can do Japanese; the 'k' is for "kpathsea," not "kanji."

Find a nice place to be the root of your source tree.

First untar the non-'j' versions of web* in the root. This produces a subdirectory web2c-6.1, containing both the web sources for TeX and friends, and the web2c converter. Obviously the "*-add*" versions come later, as far as I can tell it doesn't matter whether you do web or web2c first.

Next do the 'j' versions. These produce a subdirectory web2c-6.1j, and it must be a sibling of web2c-6.1 because it's full of symlinks of the form "../web2c-6.1."

If you are going to build xdvik and dvipsk, or just want the kpathsea library, put them here too. They untar into nice versionified subdirectories. All of these subdirectories have kpathsea subdirectories. I believe it is safe to have only one real copy of the subdirectory which is shared among xdvik, dvipsk, web2c, and web2c-j. It is probably safest to have a real subdirectory for each of the programs, and then do

     cd web2c-6.1/kpathsea; ln -s ../../dvipsk-5.58f/kpathsea/* .
in each one. It is possible that the various programs autoconfig scripts will step on each other if you symlink the subdirs instead of their leaf files. On the other hand, you may do fine with only one copy of kpathsea.a. Haven't tried it yet....

Before you build, you need to install the TeX library files. Chose a root (from here on, $ROOT) for the libraries, cd there, and untar the lib and jlib archives. Then you need to <tt>cd</tt> down to $ROOT/lib/texmf/tex/latex2e, and untar base.tar.gz there. (I think that's how it worked; you should do a tar tzf to make sure first, and maybe the "base" files needed to be in the source directory, for some reason.)


   ./configure --prefix $ROOT; make; make install
in each of the source directories.

TeXify the kanji fonts (the example here does mincho, "dm")

    cd $KANJI; wftodm -FontBase dm min*.ps jis*.ps
    for $i in *.afm; do afm2tfm ${i%.afm} -v ${i%.afm} r${i%.afm}; done
    for $i in *.vpl; do vptovf $i ${i%vpl}vf ${i%vpl}tfm; done
Move the tfms and vfs to an appropriate place (see the docs for dvipsk for this, but in general just about anywhere below $ROOT/lib/texmf/fonts/tfm and $ROOT/lib/texmf/fonts/vf respectively should do).

The README.english for the Wadalab fonts says that if you do wftodm and then pstopk, the baselines of the kanji are wrong; they are shifted up a bit. This does not appear to be true for the pfa fonts themselves, fortunately; the bottom of the hiragana are aligned with the baseline of the Helvetica and the kanji descend slightly more.

Teach Ghostscript about the fonts

It may be possible to do this using Fontpaths, but I don't understand them well. The tedious way to do it is to edit the Fontmap file. Basically, for evey single pfa file you need a line in the fontmap. For the hiragana subfont, you find
    /dmjhira		($KANJI/dmjhira.pfa)	;
All together you need about 30 of these per font.

Inhibit dvipsk from trying to make the fonts

For each of these fonts, you need to add a line to $ROOT/lib/dvips/
    dmjhira dmjhira

jatex2e code output

I have not yet messed around with jlatex2e styles to see if these automagically get included. In jtex, the following code produces a few lines of output:
    \font\myroman = phvr8r at 28pt
    \font\mysmallroman = phvr8r at 14pt
    \jfont\mymincho = dm at 28pt

    \myroman This is Helvetica.\vskip 20pt

    \mysmallroman This is more Helvetica.\vskip 20pt

    \mymincho This is Mincho \vskip 20pt
Note that jtex wants New-JIS input, although the DVI output is a sort of munged kuten I believe.

And there you have it....

If you can't afford/don't want to build all those binaries, check back with me in a bit. It may be possible to use ASCII-JTeX this way; I didn't understand dvipsk well enough when I was trying that configuration. The NTT-JTeX has the advantage, however, that only the subfonts you actually use get loaded; this can be done with wftopfa-style fonts as well, but I don't trust the code that the Wadalab project produced. Older Ghostscripts (3.33 or later is necessary I'm pretty sure) may also work.

And I still have the ambition of putting together a good package of TeX with Ghostscript for Japanese processing.... Probably not an RPM, though, it would only be about 50MB in gzip form.... ;-)

next up previous contents index
Next: GhostScript and Wada Fonts Up: Japanese Printing and Text Previous: GhostScript
Craig Toshio Oda