summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/cjk/contrib/wadalab/wadalab.txt
blob: 0a99fa084b4e02b43c5e812fbb9c06715d8a5332 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
This file describes how to set up the CJK package with Wadalab postscript
fonts for Japanese under Unix-like operating systems using distributions
based on web2c (teTeX, TeXLive, etc.).

The printer does not need to have resident Japanese fonts.


By Hin-Tak Leung <htl10@users.sourceforge.net>, September 1997.

Revised November 1998.

Last revised by Werner Lemberg, July 2006.

===================


Summary steps
-------------

  1. Download the CJK package and install it.

  2. Download and install the Wadalab font bundles for the CJK package from
     CTAN.

 3a. Update `<TEXMF>/dvips/psfont.map', or update your `~/.dvipsrc' file.
     Use the updmap script if possible.

 3b. Alternatively, create a `config.wadalab' file.

 3c. For pdfTeX, update `pdftex.map' (normally handled already by the updmap
     script).  Omit this step for recent teTeX and TeXLive versions.

 3d. For dvipdfmx (and dvipdfm), update `dvipdfm.map' (normally handled
     already by the updmap script).  Omit this step for recent teTeX and
     TeXLive versions.

  4. Run mktexlsr.

  5. Test it!


Details of each step
--------------------

1. The following files are essential and must be in your $TEXINPUTS path.

     CJK/texinput/:
       CJK.enc         CJK.sty         CJKnumb.sty
       CJKulem.sty     ruby.sty        standard.bdg
       standard.chr    standard.enc

     CJK/texinput/JIS/:
       JIS.cap         JIS.cpx         JISdnp.enc
       c42song.fd      EUC-JP.bdg      EUC-JP.chr
       EUC-JP.enc

     CJK/texinput/UTF8/:
       UTF8.bdg        UTF8.chr        UTF8.enc
       c70song.fd

   [Even if you don't use `c42song.fd' and `c70song.fd' these two files
    should be here to avoid a strange LaTeX error message if a font shape is
    missing.]

   [The EUC-JP files support real EUC-JP with single shift to access
    JIS X 0212.]

   And one or more of the following files:

       file name               Description
     ------------------------------------------------------------------------
       c42goth.fd  Gothic  JIS X 0208 (level 1,2 kanji), DNP font encoding
       c42maru.fd  Maru
       c42min.fd   Mincho

       c52maru.fd  Maru    JIS X 0212 (level 3 kanji), DNP font encoding
       c52min.fd   Mincho

       c70goth.fd  Gothic  JIS X 0208, Unicode font encoding

       c70maru.fd  Maru    JIS X 0208 + 0212, Unicode font encoding
       c70min.fd   Mincho

   And finally, `wadalab.map'.

   Also keep `CJK/examples/JIS.tex' for testing. The rest of the CJK files
   are not essential for this setup. Usage is documented in
   `CJK/examples/JIS.tex' but reading `CJK/doc/CJK.txt' and
   `CJK/doc/ruby.txt' is recommended.

   For pseudo vertical typesetting you need the `*.fdx' files accompaning
   the above `*.fd' files, together with the `CJKvert.sty' file.

   For using Unicode as the input encoding you should use `CJKutf8.sty'.

2. The CJK sub font packages of the Wadalab fonts can be found on CTAN in
   the directory `fonts/wadalab'. The real TeX font names consist of the
   concatenation of the family name with the subfont suffix. Examples:
   `dgjkeisen', `mrjkj', `umcj5d'.

       file name               TeX font family
                               DNP     Unicode
     ---------------------------------------------
       gothic-0-13.tar.gz      dgj     udgj
       maru-0-8.tar.gz         mrj     umrj
       maru-1-8.tar.gz         mr2j
       mincho-0-12.tar.gz      dmj     udmj  [*]
       mincho-0-8.tar.gz       mcj     umcj
       mincho-1-8.tar.gz       mc2j

       [*] The `udmj' family uses mc2j for glyphs Level 3 Kanji.  It doesn't
           really fit (mc2j is too thin), but it is still better than having
           no Level 3 Kanji at all.

   Installation should be straightforward since the directories in the
   font bundles already follow the TDS standard.

3a. Append `wadalab.map' to `<TEXMF>/dvips/config/psfont.map; or, for
   non-root users, create a `~/.dvipsrc' file containing this single line:

=========================================================================
p +/my-home/where_I_want_it/wadalab.map
=========================================================================

   (or add this line to your `~/.dvipsrc' if it already exists) and set
   $DVIPSFONTS to the location of the `*.pfb' files.

   teTeX and TeXLive users should do the following instead of the above:

     a) Copy `wadalab.map' into the `<TEXMF>/fonts/map/dvips/wadalab'
        directory. If you are non-root, create a private TEXMF tree in your
        home directory, and copy the file to a similar location in your
        private tree.

        Users of older versions of teTeX and TeXLive should use the
        directory `<TEXMF>/dvips/config' instead.

     b) Add the following line to <TEXMF>/web2c/updmap.cfg:

=========================================================================
Map wadalab.map
=========================================================================

        and call the updmap script to regenerate all program specific map
        files. If you are non-root, copy `updmap.cfg' from the main TEXMF
        tree to a similar location in your private tree and modify it there.

        Users of older version of teTeX and TeXLive should add `wadalab.map'
        to the `extra_modules' variable directly in the updmap script.

3b. Another solution is to just copy wadalab.map to the location in
   step 3a. After creating a file `config.wadalab', containing a single line

=========================================================================
p +wadalab.map
=========================================================================

   you can use the `-P wadalab' switch while calling dvips.

   The preferred location of `config.wadalab' is `<TEXMF>/dvips/wadalab' for
   recent teTeX and TeXLive versions, and `<TEXMF>/dvips/config' otherwise.

3c. [This step is optional and should be omitted for recent teTeX and
     TeXLive versions.]

   Append `wadalab.map' to `<TEXMF>/dvips/config/pdftex.map' so that pdfTeX
   can use the Wadalab fonts. The updmap script does this automatically.

3d. [This step is optional and should be omitted for recent teTeX and
     TeXLive versions.]

   Append `wadalab.map' to <TEXMF>/dvipdfm/config/dvipdfm.map so that
   dvipdfmx (and dvipdfm) can use the Wadalab fonts. The updmap script does
   this automatically.


4. Run mktexlsr to make your TeX system actually find your font data files.


5. Edit CJK/examples/JIS.tex and replace `\begin{CJK*}{JIS}{song}' by
   `\begin{CJK*}[dnp]{JIS}{xxx}'; `xxx' can be `min' (for mincho), `goth'
   (for gothic), or `maru'. To see the mincho-0-8 font (which is in `light'
   series), insert

     \fontseries{l}
     \selectfont

   in the CJK environment. All fonts use the poor-man's bold mechanism of
   the CJK package.

   Then do the sequence

     latex JIS.tex
     dvips JIS.dvi -j -o JIS.ps

   or

     dvips JIS.dvi -j -P wadalab -o JIS.ps

   if you haven't modified `psfonts.map'.  The `-j' switch activates partial
   font downloading (which usually is the default).

   At this stage running ghostview on `JIS.ps' should display it on screen.
   Send `JIS.ps' to a postscript printer or run ghostscript for
   non-postscript printers as you wish; and there you have your first
   printed Japanese document. Enjoy!

   Note: The level 3 Kanji fonts are generated in a DNP-like encoding also. 
         A single level 3 Kanji character can be most easily input with

           \CJKchar[JIS2]{<first-byte>}{<second-byte>}    ,

         provided that you have said

           \CJKfontenc{JIS2}{dnp}
           \CJKencfamily{JIS2}{xxx}

         in the preamble of your document to activate dnp font encoding for
         the JIS2 encoding in font shape `xxx' (which can be either `maru'
         or `min').

         In case you use Emacs or Mule together with cjk-enc.el (of the CJK
         package), JIS X 0212 characters can be displayed directly; they
         will be automatically converted into appropriate CJK macros.


How the Wadalab fonts have been created
---------------------------------------

This section contains a description of the conversion process which
transforms the raw Wadalab PS files into subfonts usable by the CJK package.

1. The Wadalab PS files are available from the original host

     ftp://ftp.ipl.t.u-tokyo.ac.jp/Font/

   Alternative locations are CTAN hosts like ftp.dante.de or ftp.tug.org and
   its mirrors:

     ftp://ftp.dante.de/pub/tex/support/ghostscript/3rdparty
           /fonts/kanji/Font

   Obtain the following files (if you download the files from CTAN, the
   final extension is `.gz' instead of `.Z'):

     wadalab-sym.7.tar.Z          (symbols + Greek letters, necessary)

     wadalab-mincho-0-12.8.tar.Z  (JIS X 0208 level 1,2 kanji)
     wadalab-gothic-0-13.5.tar.Z
     wadalab-mincho-0-8.4.tar.Z
     wadalab-maru-0-8.4.tar.Z

     wadalab-maru-1-8.tar.Z       (JIS X 0212 level 3 kanji)
     wadalab-mincho-1-8.tar.Z

     tools/wftodm.c               (conversion program, c.f. step 2)

   Unpack the font archives in a temporary directory; you should get
   subdirectories called `wadalab-sym', `wadalab-mincho-0-12', etc.

   Note: DO NOT read the misleading `readme.ghostscript' document which
         accompanies the fonts.


2. Patch `wftodm.c' with the following to enable partial font downloading. 
   You can simply say

        patch < wadalab.txt

   to do that.

=========================================================================
--- wftodm-orig2.c      Tue Sep 23 22:45:32 1997
+++ wftodm.c    Sun Jul 30 08:56:43 2006
@@ -1,6 +1,8 @@
 #include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
 #include <sys/types.h>
-#include <sys/time.h>
+#include <time.h>
 char *charstrs[34][256];
 int charlens[34][256];
 char *version_str="001.001";
@@ -157,6 +159,7 @@
       output_afm(i);
     }
   }
+return 0;
 }
 output_afm(file)
 {
@@ -209,14 +212,13 @@
   fprintf(ofp,"/UnderlineThickness 0 def\n");
   fprintf(ofp,"end readonly def\n");
   fprintf(ofp,"/FontName /%s def\n",fontname);
-  fprintf(ofp,"/DmEncoding [\n");
+  fprintf(ofp,"/Encoding 256 array\n");
+  fprintf(ofp,"0 1 255 {1 index exch /.notdef put} for\n");
   for(i=0;i<16;i++){
     for(j=0;j<16;j++)
-      fprintf(ofp," /c%02X",i*16+j);
-    putc('\n',ofp);
+      fprintf(ofp,"dup %d /c%02X put\n",i*16+j,i*16+j);
   }
-  fprintf(ofp,"] readonly def\n");
-  fprintf(ofp,"/Encoding DmEncoding def\n");
+  fprintf(ofp,"readonly def\n");
   fprintf(ofp,"/PaintType 0 def\n");
   fprintf(ofp,"/FontType 1 def\n");
   fprintf(ofp,"/FontMatrix [.001 0 0 .001 0 -0.16] readonly def\n");
=========================================================================

   After compilation with

     cc -O -o wftodm wftodm.c

   use it as follows:

     wftodm -FontBase dg wadalab-sym/jis*.ps wadalab-gothic-0-13/goth-*.ps
     wftodm -FontBase dm wadalab-sym/jis*.ps wadalab-mincho-0-12/min-*.ps
     wftodm -FontBase mc wadalab-sym/jis*.ps wadalab-mincho-0-8/min-*.ps
     wftodm -FontBase mr wadalab-sym/jis*.ps wadalab-maru-0-8/maru-*.ps
     wftodm -FontBase mc2 wadalab-mincho-1-8/min*.ps
     wftodm -FontBase mr2 wadalab-maru-1-8/maru*.ps

   [Note: The order of the PS files on the command line doesn't matter.]

   You should then get a whole set of {dg,dm,mc,mr}j[*].{afm,pfa} files in
   your current directory, with [*]={greek,keisen,roma,russian,sy} coming
   from sym-dir, and [*]={hira,kata,ka-kz} from the Kanji fonts.
   {mc2,mr2}j[*].{afm,pfa} with [*]={ka-kw} are JIS X 0212 level 3 Kanji
   font files.

   Note: `wftodm.c' has been updated in Oct 97; previous versions will fail.


3. Run the `makefont' script. It first normalizes the font matrix (to make
   the subfonts work with pdfTeX), then it calls afm2tfm on each of the afm
   files, and run t1disasm/t1asm (which are part of the t1utils package) on
   each of the PFA files to convert them to PFB files which are much
   smaller.


4. Run the `fixwada2.pl' script to correct the glyph names. This needs the
   perl program and the files `DNP.sfd' (from the CJK package),
   `JIS0208.TXT', and `JIS0212.TXT' (from ftp.unicode.org, in the `OBSOLETE'
   directory).

     perl fixwada2.pl dgj jis0208
     perl fixwada2.pl mrj jis0208
     perl fixwada2.pl mr2j jis0212
     perl fixwada2.pl dmj jis0208
     perl fixwada2.pl mcj jis0208
     perl fixwada2.pl mc2j jis0212


5. Run the `makeuniwada.pl' script -- it needs the same auxiliary files
   as `fixwada2.pl' -- to create virtual fonts for Unicode input encoding.

     perl makeuniwada.pl dgj udgj
     perl makeuniwada.pl mrj mr2j umrj
     perl makeuniwada.pl dmj mc2j udmj
     perl makeuniwada.pl mcj mc2j umcj


Thanks
------

 Werner Lemberg <wl@gnu.org> for creating CJK and comments to this help
 document.

and

 Joshua Redstone <redstone@cs.washington.edu> for contribution to non-root
 setups.

Also check out the following variables: $TEXFORMATS, $TEXINPUTS, $TEXFONTS,
$DVIPSFONTS.


Please send any suggestions or comments to LEUNG Hin-Tak <htl10@cam.ac.uk>.

---End of wadalab.txt---