This file is part of the CJK package for LaTeX2e.


                              NTU2CJK v1.8


INTRODUCTION

   This utility produces PostScript Type 1 fonts for use with the CJK
   package written by Werner Lemberg <a7971428@unet.univie.ac.at>. The font
   sources are Big-5 encoded Chinese NTU TrueType fonts.


MANIFEST
   
   README      -- This file.
   README.jac  -- Notes for Jackson font.
   History     -- A simple history of ntu2cjk.
   ChangeLog   -- Change logs.

   Makefile    -- Makefile for GNU make.
   kai.mak     -- font specific variables defined for Kai Su Zi.
   *.mak       -- other font specific makefile.

   ntu2cjk.c   -- NTU TrueType font to PostScript Type 1 font converter. It
                  is based on ttf2ps.c, which was written by Liangsheng Wu
                  <lsn@mail.soton.ac.uk>.
   ntu2cjk.exe -- executable for DOS and OS/2

   ntu2ps
   ntu2ps.bat
   ntu2ps.cmd  -- interface to invoke convertor of NTU TTF to PostScript
                  font. 

   t1asm.c
   t1binary.c  -- source files taken from the t1utils package.
   t1asm.exe
   t1binary.exe-- executables for DOS and OS/2

   getafm      -- Script file (for UNIX) for obtaining the AFM file. Used in
                  conjunction with printafm.ps or getafm.ps .
   getafm.bat
   getafm.cmd  -- Batch files (for DOS and OS/2) for obtaining the AFM file.
                  Used in conjunction with getafm.ps or printafm.ps .
   printafm.ps -- PS file to get AFM file from PFB or PFA font. Copied from 
                  the GhostScript 3.53 package. Faster than getafm.ps .
   getafm.ps   -- PS file for getting AFM file from PFB or PFA font. 

   vmusage 
   vmusage.bat
   vmusage.cmd -- Script file (for UNIX) and batch files (for DOS and OS/2)
                  for estimating VMusage of a font. Used in conjunction with
                  vmusage.ps .
   vmusage.ps  -- PS file for estimating the %%VMusage field in Type 1
                  fonts.
   vmmodify.c  -- used in conjunction with vmusage to calculate the
                  %%VMusage field in Type 1 fonts.
   vmmodify.exe-- executable for DOS and OS/2.

   gen_map     -- Unix script to generate the Fontmap-like and psfonts.map-
		  like file. (not used)
   mkmap.c     -- same as gen_map.
   mkmap.exe   -- executable for DOS and OS/2.
   
   c00?????.fd -- Sample .fd files.
   c00?????.fdx-- Sample .fd files if you have produced bold fonts too.
                  You should rename them to c00?????.fd if you use them.  

   rm.bat
   rm.cmd      -- Batch files (for DOS and OS/2) emulating the UNIX command
                  `rm -f'

   exitserv.ps -- PS file for downloading PS fonts.
   reset.ps    -- PS file for removing PS fonts from the printer.

   download
   download.bat-- Unix script and DOS/OS2 batch files to generate
                  collected .pfa fonts which can be used to download PS
                  fonts to PostScript printer or to Ghostscript
                  interpreter.

   MakeTeXPK.diff
               -- Diff file that can be patched to MakeTeXPK script in the
                  teTeX 0.4 (might be compatible to older version) package,
                  if you expect dvips to be capable of generating PK fonts
                  under the installing font mapping mechanism of the
                  package.  See the teTeX.doc for more information.
   
   chr2ps.c    -- Conversion of charstring to PostScript. Taken from the
                  ps2mf package.
   chr2ps.h, defines.h, myerror.c, myerror.h, mymalloc.c, mymalloc.h,
   myopen.c, myopen.h 
	       -- sources and headers required by chr2ps
   
   jack2chr.ps -- Extract glyph definition and compose Type 1 font for
                  Jackson font.
   jack2ps     -- Script similar to ntu2ps but for Jackson font.
   jack2ps.bat
   jack2ps.cmd -- DOS/OS2 batches.
   kaisu.ofs   -- Offset data for Jackson font.

   Type0-Regular.ps, Type0.ps
               -- sample top level of Type0 fonts.
   mktype0     -- Shell script to make top level font of PostScript Type 0
                  font.    

   *.btm       -- Outdated 4DOS batch files and description. Don't use them. 


NECESSARY PACKAGES

   0. To install automatically you need GNU make (tested with version 3.74).
      To compile you need the GNU C compiler (tested with version 2.7.2).
      To use the precompiled binaries for DOS and OS/2 you need the emx
      runtime package emxrsx.zip (to be found on the CTAN archives in
      tex-archive/systems/msdos/emtex).

   1. The NTU TrueType fonts.
      These fonts can be obtained from the Chinese Community Information
      Center (CCIC) of IFCSS at ftp.ifcss.org [128.123.1.55] or its mirror
      sites, cnd.org [132.249.229.100] and nctuccca.edu.tw [140.111.3.21]
      via anonymous ftp, in the directory /pub/software/fonts/big5/ms-win on
      IFCSS or /Chinese/ifcss/software/fonts/big5/ms-win on nctuccca.edu.tw .
      Refer to the file ntu_font.txt in that directory for more information.

   2. The Ghostscript package.
      On CTAN:
      DOS:  support/ghostscript/aladdin/gsXXX*.zip
      UNIX: <same dir.>/ghostscript-X.XX*.gz and its relavent font file.
      where X.XX or XXX is the version number.

   3. The DVIPS package. (If you expect the feature of partially downloaded
      PostScript fonts, fetch version of 5.66 or higher.)
      On CTAN: 
      DOS:  systems/msdos/dviware/dvips/
      UNIX: dviware/dvips/
	    dviware/dvipsk/

      
INSTALLATION

  1. Make sure that GS (Ghostscript) and DVIPS are installed.

  2. Modify the contents of kai.mak according to the setup of your own site
     if you want to generate Kai font family. If you want to generate other
     font families, modify its corresponding .mak file.

  3. Type 'make' to see a summary how to make fonts. To make the programs
     and fonts with GNU make say, as an example,

        make dos FONTMAK=kai.mak PLANES="01 02 03"

     to make the first three Kai sub-fonts under DOS with djgpp. Note that
     it will take hours if you make all the sub-fonts on a 386 PC. To make
     all FangSong sub-fonts from a NTU font under UNIX, just type

        make unix FONTMAK=fs.mak

     After the make task is complete, check the size of each generated TFM
     files. Make sure that they all have a size of about 1.2 kByte. If not,
     see the NOTES section below for how to fix this.

  4. Install the created files with

        make install-fonts FONTMAK=<font-makefile>

     In addition, you may need to install the font map files (if their
     contents are what you want) with

        make install-maps FONTMAK=<font-makefile>

     Or you can just say "make install FONTMAK=<font-makefile>" to install
     all files.

     Note that the default generated fontmap (the value of the variable
     PSFONTMAP in font specific makefile) for use with dvips is CJK.map .
     This fontmap contains only CJK PS fonts. After the make completes, it
     will create a file named config.CJK which contains the line
     "p=+$(PSFONTMAP)" only (the variable will be replaced with your input),
     in our default case "p +CJK.map", and it will be stored to the same
     directory where the config.ps resides when installing. You could add
     the command line option "-P CJK" when running dvips to declare that
     these fonts are printer-resident.  You could also insert the contents
     of config.CJK to config.ps, which cause dvips to always regard them
     as printer-resident fonts.

  5. If you want to install the fonts manually instead of saying `make
     install-fonts', you must copy all the created .pfb and .tfm files to
     the appropriate directories. Additionally you must also modify the
     contents of the files `Fontmap' (for use with GS) and `CJK.map' (or
     `psfonts.map') (to be used with dvips) in their installed directories.

     You can use the script gen_map (or gen_map.bat for DOS) to create parts
     of Fontmap and CJK.map which can then be appended to the corresponding
     files afterwards. For example, say
     
        gen_map KaiSu b5ka CJK.map Fontmap

     to append font map entries (as described below) to the corresponding
     files if the files exist or to create these two files if they are
     nonexistent. gen_map will not overwrite existing entries and will do
     nothing for font entries already defined in these map files.

     You can create them manually, see NOTES below. If you are running this
     package under DOS or OS2, you should create these maps by hand. 
    
     Then create the file config.CJK containing the line below which can
     be used with dvips by adding a command line option "-P CJK" (see
     above):

     +p CJK.map

  6. Modify the related C00?????.fd font definition files to suit your LaTeX
     environment and the created font, then copy them to the proper
     directory. If you set the variable EXTENDED_FONTS to YES in the
     Makefile, you can change the content of related C00?????.fdx files
     accordingly, then copy them to the prescribed directory and rename them
     from *.fdx to *.fd .

  7. If you want to try the feature of partially downloading fonts, you must
     reproduce all PFB fonts. That is, remove all old PFB fonts, uncomment
     the download option in the font specific makefile, then make again.

  That's it. Enjoy!


NOTES

  1. This package has not been tested thoroughly on PC. In fact the author
     built these CJK fonts only on HP 9000/730 and on Linux. It takes about
     10 minutes to process one NTU font on the HP. Linux running on a
     Pentium 75 board with 16MB RAM also needs 10 minutes to create all 55
     KaiSu fonts from NTU_KAI.TTF.

     Some of the sub-fonts will probably not be loaded by GS in the PFB
     format. This leads to the fact that some of the AFM files can't be made
     (as well as the corresponding TFM files). [I'm not sure where the
     problem is. At least, now I can make all sub-fonts without errors using
     GS 3.33 and higher.] In this case, replace the specific entries in the
     Fontmap file with the PFA fonts, remove corresponding AFM and TFM files
     (or do `make clean' on the corresponding sub-font), and remake the
     sub-font again. For example, if b5ka01.pfb can't be loaded by GS,
     replace
 
        /Kaisu01 (b5ka01.pfb) ;

     with
 
        /Kaisu01 (b5ka01.pfa) ;

     in the Fontmap file. Remove b5ka01.tfm and b5ka01.afm either manually
     or by typing

        make clean FONTMAK=kai.mak PLANES=01

     and then type

        make unix FONTMAK=kai.mak PLANES=01

    (or 'make dos FONTMAK=kai.mak PLANES=01')

     to remake it. This should work (if this doesn't work :-(((...).

  2. If you don't want to create extended fonts (with a width increased by a
     factor 1.2), make sure that the setting to the variable EXTENDED_FONTS
     is NO. These `virtual fonts' (no .vf fonts created, just those related
     .tfm files to be created) are built on the corresponding normal fonts
     and should be used in conjunction with the corresponding C00?????.fdx
     files (you also need to rename its extentions to .fd and modify
     accordingly, see above).

  3. You can create font map files manually. For instance, if the prefix
     name of the font files is "b5ka", and the prefix of PostScript
     fontnames is "KaiSu", append the following lines (totally 55 lines) to
     the Fontmap file:

        /KaiSu01 (b5ka01.pfb) ;
        ...
        /KaiSu55 (b5ka55.pfb) ;

     and the following lines (totally 55 lines) to CJK.map:

        b5ka01 KaiSu01
        ...
        b5ka55 KaiSu55

     If you also want to use the extended fonts (only the .tfm files are
     needed additionally) and we suppose that the prefix for extended fonts 
     is "b5kax", append the following lines (55 lines) to CJK.map also:

        b5kax01 KaiSu01 "1.2 ExtendFont"
        ...
        b5kax55 KaiSu55 "1.2 ExtendFont"

     Again, you can use gen_map to generate these entries: just say

        gen_map -x b5ka KaiSu b5kax CJK.map

     Or, if you expect to utilise the feature of partial downloading fonts
     provided by dvips 5.66 or higher, append each of above line with
     correspond PFB font name, eg.:

	b5ka01 KaiSu01 <b5ka01.pfb

     or, for extended fonts:

	b5kax01 KaiSu01 "1.2 ExtendFont" <b5ka01.pfb 

     etc. You can also generate them by:

	gen_map -d KaiSu b5ka CJK.map

     or

	gen_map -d -x b5ka KaiSu b5kax CJK.map

     respectively.

  4. The default settings of Fontmap and CJK.map in this version are
     simulations of printers with resident PostScript fonts. Before the
     dvips version 5.6, if you set these fonts as non-resident fonts,
     i.e. in the psfonts.map if you set each entry as:

        b5ka01 KaiSu01 <b5ks01.pfb
     
     the created output file by dvips will be very large in size (including
     about twenty .pfb fonts for a small chinese document). Although it is
     "portable" and self-contained, this is not what we expect.

     Fortunately, the dvips 5.6 or higher (you'd better try 5.66 or higher),
     has module for solving this problem. This new release will load only
     used characters (instead of the whole font file) from PostScript fonts
     on demand, just as it does for .pk fonts.  The most recent version
     (5.72) had fixed some bugs in the module of partailly downloading Type
     1 fonts.

  5. Another package named "fontload", which is also available on CTAN (in
     the directory fonts/utilities/fontload), is probably the most suitable
     solution for generating a self-contained Chinese document in PostScript
     format using the fonts generated by NTU2CJK. In some cases fload can
     produce smaller .ps files than using the PCL format.

  6. If you got trouble when extracting AFM file from PFB fonts, either
     check the NOTE 1 above or replace printafm.ps with getafm.ps in the
     getafm (GETAFM.BAT) script.

  7. The author currently doesn't use ttf2pk (see ttf2pk.doc) to make PK
     fonts, but uses gsftopk or ps2pk instead. There is a patch file
     MakeTeXPK.diff which can be applied to the MakeTeXPK script of the
     teTeX package to generate PK fonts on the fly.

  8. If you have a PostScript printer at hand and you want to download the 
     generated PFB fonts to the printer:
      
    a. if there is enough memory in your printer (say 16MB or more, I'm not
       sure. If you have disks connected to the printer, see the "Technical
       Note #5040" from Adobe titled "Supporting Downloadable PostScript
       Language Fonts", also on the CTAN sites), you can try to download a
       series of subfonts (01-23, the most frequently used Big5 characters)
       to the printer by:
   
      i) run pfb2pfa (or a similar program) on each subfont of a shape, e.g.

                cat exitserv.ps > fonts.ps
                pfb2pfa b5ka01.pfb temp.pfa
                cat temp.pfa >> fonts.ps
                ...
                pfb2pfa b5ka23.pfb temp.pfa
                cat temp.pfa >> fonts.ps

        You can also execute the script `download' to do this.

      ii) to download fonts "permanently":
	
                lpr fonts.ps

      iii) When you have a document created by dvips (psfonts.map must be
       installed with gen_map as described above), you can then print it to
       your PS printer directly by `lpr yours.ps' or a similar command.
  
    b. If the printer has less than 8MB memory, and you have no plans to add
       "new" characters to your document, but just want to adjust the layout
       or typesettings, you can use the fload (from the `fontload' package)
       to extract those characters to a temparory file, e.g.

                fload your_near_final_doc.ps > temp.ps

       Then extract the definitions for those fonts from the header of
       temp.ps into a file, say fonts.ps . The content of temp.ps may look
       like this:

                %!PS-Adobe-3.0
                mark %%
                %!FontType1-1.0: CJKKaiSu 001.001
                %%CreationDate: Jan. 20, 1996
                %%VMusage: 253765 254029
                11 dict begin
                [snipped .... snipped]	% lots of fonts definitions
                end cleartomark%%
                %!PS-Adobe-2.0
                %%Creator: dvipsk 5.58f Copyright 1986, ...
                %%Title: sscdcb.dvi
                %%Pages: 24
                [snipped .... snipped]	% the rest of file

       then cut from the first line to the last line of the last font's
       definition (before the line "%!PS-Adobe-2.0" in this example) to
       fonts.ps for example. Finally you can follow the second step (ii) of
       the above paragraph (a.).

    c. To unload the fonts simply say

                lpr reset.ps

  9. The same strategy could also be applied to the Ghostscript interpreter.
     If your computer has enough virtual memory the use of downloaded fonts
     in Ghostscript has several advantages. First, each page will be
     displayed very quickly. Second, you don't have to wait minutes until
     all fonts has been processed since the number of fonts which must be
     loaded on demand will be small. Third, you don't need to generate the
     .pk fonts manually or automatically for different font sizes (as
     required in your document) if you love to change font sizes.

     However, the disadvantage is that you must keep at least one
     Ghostscript session alive (don't quit from GS if you want to preview
     your PS document each time you modify your document or you want to
     print it by GS), and you must learn some GS interpreter commands (I'm
     not sure whether Ghostview, the standard front end to GS, can use the
     same GS process). That sounds minor to the benefit you obtain from it.

     Here is an example of how to download .pfb to GS:

            % download -i b5ka0[1-9].pfb     # -i to initialize the output.
            % download b5ka1[0-9].pfb
            % download b5ka2[0-3].pfb        # concatenate kai .pfa fonts
                                             # from plane 1 to 23.

     A default output file "dl-fonts.ps" is created. Now start the GS
     interpreter and run the file as:

            % gs dl-fonts.ps
            [some information ... and it will take time to load fonts]
            GS> 
            GS> (your_CJK_output.ps) run
            [soon, your document is then displayed!]
            [for each showpage pausing, press return ...]
            GS>
            GS> (your_another_CJK.ps) run
            [no needs to load CJK fonts again ...then, soon, displayed!]
            ... 

     To display a PS document in this way is almost as fast as if it were
     displayed by xdvi! It sounds good!

 10. When you want to generate a self-contained PostScript output with the
     recent version of dvips (5.58 or older), be sure to disable the
     compression of bitmap fonts. That is, either comment out the "Z" option
     in the config.ps or add an option "-Z0" to the command line of dvips.
     You will not encounter problems if you set the compression flag and
     your document is small in size. But if you use lots of fonts in your
     document, then you might have to face the fact that it couldn't be
     previewed by gs or printed to a PostScript printer.
   
     The new version of dvips (5.66 or higher) seems to work fine with
     compressed bitmap fonts.

 11. When you had installed a few of NTU CJK PS fonts, be notice the
     occurance of these font map files: psfonts.map, Fontmap, and
     CJK.map. If you encountered the fact that for some NTU font family you
     can latex and preview without any troubles but for others you just
     can't. Then you might have them stored in more than two places. 

     When they are utilised by programs, there are a list of directories to
     be searched for these map files. Be sure to let these program to find
     the right one. A rule of thumb is they almost search them your working
     directory first, then your home directory, and then the system
     directory.  So be sure to just keep one final installed map file (in
     the system directory).


ACKNOWLEDGEMENT
 
   Many thanks to Werner Lemberg, he gives me lots of suggestions and 
   maintains parts of this package.
   
   Thanks to Sam Chiu <ccc11@cus.cam.ac.uk>, he pays attentions to this 
   package and suggests me a lot.  

   Also thanks to those who give their efforts to this field so I can
   typeset documents with high quality.


THE AUTHOR

  Chun-Yu Lee
  e-mail: d791013@ce.ntu.edu.tw
          chunylee@ms1.hinet.net

%% $Id: README,v 1.11 1997/06/25 05:14:01 d791013 Exp $
