Ghostscript Kanji Package gs261j
Version 1.0 Jan.11,1994 by Norio KATAYAMA (katayama@nacsis.ac.jp)
Copyright (C) 1991,1992,1993,1994 Norio Katayama.
This document is translated into English on Jan.11,1994.


Features
========

  1. Support for Japanese.
    a. composite fonts.
    b. font metrics (Metrics, Metrics2, CDevProc).
    c. vertical writing (WMode).

  2. Support for Kanji font files.
    a. X11R5 PCF font files.
    b. X11R4 SNF font files.
    c. Sony(TM) vector font files.
    d. Zeit(TM) format font files.
		Authors:  Takuji KAWAMOTO, and Yasunari INOUE.
    e. Zeit(TM) JG format font files.
		Author:  Kazunori ASAYAMA
    f. JTeX PK font files.

  3. Device drivers.
    a. gdevnwp (Sony NWP-533/537 printer)
    b. gdevlips (Canon LIPS-II/II+/III printer)
		Author:  Akihisa KURASHIMA
    c. gdevp201 (NEC PC-PR201 printer)
    d. gdevp150 (NEC PC-PR150 printer)
		Author:  Takuya KOUMOTO
    e. gdevepag (ESC/Page)
		Author:  Hiroshi NARIMATSU
    f. gdevj100 (Star JJ-100 printer)
		Author:  Caz Yokoyama
    g. gdev10v  (Canon BJ10v printer)
                Authors:  Teruo IWAI, Atusi MAEDA, Takao MATUI


Tested Environments
===================

  +--------------+-----------------+-----------------+-------------+
  |  OS          |  Machine        |  Compiler       |  Device     |
  +--------------+-----------------+-----------------+-------------+
  | SunOS 4.1.3  | SPARC Station 2 | cc -O  / gcc -O | X11         |
  +--------------+-----------------+-----------------+-------------+



Notes
=====

Any questions, requests, and bug reports are welcomed.
  JUNET: katayama@nacsis.ac.jp	NIFTY: NBB01613



Notices
=======

Sony vector font files, Zeit format font files, and JTeX PK font files
are commercial products. Please be careful not to violate their
licenses.

This Kanji package is not an official patch. Therefore you should keep
the original distribution.

No author takes responsibility for the consequences of using this
package.

Everyone is permitted to copy, modify and redistribute this package
only for nonprofit use.


How to install (UNIX)
=====================

[1] Building Ghostscript

(1) Extract source files from the original distribution of Ghostscript
    version 2.6.1.
    This package is based on the source files to which the following
    patches are applied.
        ghostscript-2.6.1.fix-01.gz
        ghostscript-2.6.1.fix-02.gz
        ghostscript-2.6.1.fix-03.gz
        ghostscript-2.6.1.fix-04.gz

(2) Extract the contents of this package in the directory containing
    the original source files.

(3) Apply a patch file `gs261j.diff' to the original source files.

(4) Copy unix-cc.mak, unix-gcc.mak or unix-ansi.mak onto Makefile, and
    edit it appropriately. At least four configurations described
    below must be done.

 1. Set prefix, exec_prefix, bindir, datadir, and gsdatadir macros to
    specify the directory to which Ghostscript will be installed.


 2. Set CFLAGS, LDFLAGS, EXTRALIBS, XINCLUDE, and XLIBDIRS macros to
    configure compilation options.
    
 3. Choose the features of Kanji font files to be included and add
    some of the symbols listed below to FEATURE_DEVS.

	kfpcf.dev	X11R5 PCF font files.
	kfsnf.dev	X11R4 SNF font files.
	kfsony.dev	Sony vector font files.
	kfzeit.dev	Zeit format font files.
	kfztbez.dev	Zeit JG format font files.
	kfjtex.dev	JTeX PK font files.

  Examples)
      To include the features of PCF font files, SNF font files, Zeit
      format font files, Zeit JG format font files, and JTeX PK font files.

	FEATURE_DEVS=filter.dev dps.dev level2.dev kanji.dev \
		     kfpcf.dev kfsnf.dev kfzeit.dev kfztbez.dev kfjtex.dev
	
      To include the feature of Sony vector font files only.

	FEATURE_DEVS=filter.dev dps.dev level2.dev kanji.dev \
		     kfsony.dev

      To include the features of PCF font files, SNF font files, Zeit
      format font files, Zeit JG format font files, JTeX PK font files,
      and Sony vector font files.

	FEATURE_DEVS=filter.dev dps.dev level2.dev kanji.dev \
		     kfpcf.dev kfsnf.dev kfzeit.dev kfztbez.dev kfjtex.dev \
                     kfsony.dev


 4. Choose the devices to be included and add the symbols for them to
    DEVICE_DEVS.

  Example)
      To include the device driver of X11.

	DEVICE_DEVS=x11.dev

    If you want to use the device drivers contained in this package,
    see documents in the `drivers' subdirectory.


(5) MAKE and install Ghostscript.

(6) Extract font files from ghostscript-fonts-2.6.1.tar.gz into the
    directory specified by the gsdatadir macro in Makefile.

  Example)
      When gsdatadir is the default value (/usr/local/lib/ghostscript) :

        % cd /usr/local/lib/ghostscript
        % gunzip < ghostscript-fonts-2.6.1.tar.gz | tar xvf -


[2] Configuring Kanji Fonts

(1) Change the working directory to the `kanji' directory which is a
    subdirectory of the directory specified by the gsdatadir macro in
    Makefile.

  Example)
      When gsdatadir is the default value (/usr/local/lib/ghostscript) :

        % cd /usr/local/lib/ghostscript
        % cd kanji

(2) Copy one of the following template files onto `kconfig.ps'.

	pcf.ps	 for X11R5 PCF font files.
	snf.ps	 for X11R4 SNF font files.
	sony.ps	 for Sony vector font files.
	zeit.ps	 for Zeit format font files.
	ztbez.ps for Zeit JG format font files.
	jtex.ps  for JTeX PK font files.

(3) Edit `kconfig.ps' appropriately. Normally, you have only to change
    the names of font files.

  The details of `kconfig.ps' are described in the section ``Kanji
  Configuration File''.


[3] Testing Kanji fonts.

  Execute the following sample programs with gs and verify Kanji fonts
  are displayed correctly.

	hankaku.ps	A list of half-width Kanji characters.
	allkanji.ps	A list of Kanji characters.
	fmaptype.ps	A test program of the composite font mapping.
	vchars.ps	A list of characters for vertical writing.
	article9.ps	Article 9 of the Constitution of Japan.

  Because sample programs are contained in the Kanji library directory,
  you need not specify a directory path.

	Example)
	    % gs hankaku.ps

Note
----
   If you use X11R4 SNF font files which are provided by manufactures
   (i.e. not made from the MIT distribution), it is possible that
   Kanji characters are not displayed correctly. This is because the
   SNF format is dependent on X server and the default values defined
   in bdftosnf.h is not appropriate to the server. Edit lines from 37
   to 53 in zkfsnf.c to solve this problem.



Kanji Configuration File
========================

  Kanji fonts for Ghostscript are defined in the Kanji configuration
  file. The name of this file is `kconfig.ps' by default, but it can
  be changed by -sKCONFIG switch (see the section `Command switches').

[1] Definition of Kanji Fonts

  Kanji fonts are defined in the following format.

	FontName  UniqueID  [ FileName ]  Operator

    FontName
	is a name of the Kanji font to be defined.
        `/Ryumin-Light' and `/GothicBBB-Medium' are standard Kanji fonts.

    UniqueID
	is a unique identifier of the font.
	Normally, the identifiers may be set from 4300000 with 200
        differences.

    FileName
	is the name of the font file to be used.
	The rule of this field is determined by `Operator', so see
        comments in the template files for details

    Operator
	is a Ghostscript operator to define Kanji font.

  For example, if you want to define a Kanji font with a name
  `/Ryumin-Light' using a X11R5 PCF font file whose path name is
  "/usr/lib/X11/fonts/misc/k24.pcf", you will write the following line
  in the Kanji configuration file.

  /Ryumin-Light  4300000 (/usr/lib/X11/fonts/misc/k24.pcf) pcfkanji

  With this line, the following Kanji fonts will be available.

    /Ryumin-Light.r##	(## = 21 - 7E)		horizontal JIS  base Kanji
    /Ryumin-Light.r##v	(## = 21, 22, 24, 25)	vertical   JIS  base Kanji
    /Ryumin-Light.sr##	(## = 81 - 9F, E0 - EA)	horizontal SJIS base Kanji
    /Ryumin-Light.sr##v	(## = 81 - 83)		vertical   SJIS base Kanji

    /Ryumin-Light.Roman		half-width alphanumeric characters
    /Ryumin-Light.Hiragana	half-width Hiragana
    /Ryumin-Light.Katakana	half-width Katakana
    /Ryumin-Light.Hankaku	half-width alphanumerics, Hiragana, Katakana
    /Ryumin-Light.SuppK		half-width Katakana for SJIS

    /Ryumin-Light-H		horizontal JIS          Kanji
    /Ryumin-Light-V		vertical   JIS          Kanji
    /Ryumin-Light-Ext-H		horizontal Extended JIS Kanji
    /Ryumin-Light-Ext-V		vertical   Extended JIS Kanji
    /Ryumin-Light-EUC-H		horizontal EUC          Kanji
    /Ryumin-Light-EUC-V		vertical   EUC          Kanji
    /Ryumin-Light-RKSJ-H	horizontal Roman, Katakana, SJIS Kanji
    /Ryumin-Light-RKSJ-V	vertical   Roman, Katakana, SJIS Kanji
    /Ryumin-Light-83pv-RKSJ-H	horizontal Roman, Katakana, SJIS Kanji

  Although Kanji fonts in Extended JIS Encoding are defined,
  characters to be displayed are determined by the contents of font
  files. For the same reason, the Kanji encoding such as JIS-78 and
  JIS-83 are also determined by font files.

[2] Definition of Aliases

  An operator `copykanji' can be used to define aliases of Kanji fonts.
  The following is the format of `copykanji'.

	FontName   NewName  copykanji

  For example, the following line defines an alias `/ChuGothicBBB-Medium'
  for the font `/GothicBBB-Medium-83pv-RKSJ-H'.

	/GothicBBB-Medium-83pv-RKSJ-H  /ChuGothicBBB-Medium  copykanji


Command Switches
================

New command switches are available.

    -dNOKANJI		Suppress installing Kanji fonts.
    -sKCONFIG=foo.ps	Define the name of the Kanji configuration file.


Acknowledgements
================

In developing this package I obtained cooperation from the following
persons. I make my acknowledgement with thanks to them.

Cooperators in developing gs23j10.
	IKAWA, Takanori UGAI, Yoshihiro OHMI, Tetsuya OHYAMA, 
        Akihisa KURASHIMA, Masayuki KUWADA, NAKAMARU, NORO, 
	and Hisashi MINAMINO

Authors of the feature of Zeit format font files.
	Takuji KAWAMOTO, and Yasunari INOUE

Author of the feature of Zeit JG format font files.
	Kazunori ASAYAMA

Author of the Canon LIPS-II/II+/III printer driver.
	Akihisa KURASHIMA

Author of the NEC PC-PR150 printer printer driver.
	Takuya KOUMOTO

Author of the ESC/Page printer driver.
	Hiroshi NARIMATSU

Author of the Star JJ-100 printer driver.
	Caz Yokoyama

Author of the Canon BJ10v printer driver.
	Teruo IWAI, Atusi MAEDA, Takao MATUI


File List
=========

gs261j.doc		Document of this package (English)
gs261j.jis		Document of this package (Japanese in JIS Kanji)
gs261j.sj		Document of this package (Japanese in SJIS Kanji)
gs261j.euc		Document of this package (Japanese in EUC Kanji)

gs261j.diff		Patch file for Ghostscript version 2.4.1

zcomp.c			C program defining composite font operators.
kfutil.c		C program defining Kanji font utilities.
zkfimpath.c		C program defining imagepath operator.

zkfpcf.c		C program defining PCF font file operator.
zkfsnf.c		C program defining SNF font file operator.
zkfsony.c	       	C program defining Sony vector font file operator.
zkfzeit.c		C program defining Zeit font file operator.
zkfztbez.c		C program defining Zeit JG font file operator.
zkfjtex.c		C program defining JTeX PK font file operator.

drivers/
    gdevnwp/		Sony NWP-533/537 printer driver
    gdevlips/		Canon LIPS-II/II+/III printer driver
    gdevp201/		NEC PC-PR201 printer driver
    gdevp150/		NEC PC-PR150 printer driver
    gdevpag/		ESC/Page printer driver
    gdevj100/		Star JJ-100 printer driver
    gdev10v/            Canon BJ10v printer

kanji/
    kinit.ps		GS program for Kanji environment.
    metrics2.ps		GS program for vertical writing.
    kbitmap.ps		GS program for bitmap Kanji fonts.
    koutline.ps		GS program for outline Kanji fonts.
    kbase.ps		GS program for defining Kanji base fonts.
    kcomp.ps		GS program for defining Kanji composite fonts.
    kmapping.ps		GS program for the mapping from symbols to JIS codes.

    kfpcf.ps		GS program for X11R5 PCF font files.
    kfsnf.ps		GS program for X11R4 SNF font files.
    kfsony.ps	       	GS program for Sony vector font files.
    kfzeit.ps		GS program for Zeit format font files.
    kfztbez.ps		GS program for Zeit JG format font files.
    kfjtex.ps		GS program for JTeX PK font files.

    pcf.ps		Template file for X11R5 PCF font files.
    snf.ps		Template file for X11R4 SNF font files.
    sony.ps		Template file for Sony vector font files.
    zeit.ps		Template file for Zeit format font files.
    ztbez.ps		Template file for Zeit JG format font files.
    jtex.ps		Template file for JTeX PK font files.

    hankaku.ps		Sample of half-width Kanji characters.
    allkanji.ps		Sample of Kanji characters.
    fmaptype.ps		Sample of the composite font mapping.
    vchars.ps		Sample of characters for vertical writing.
    article9.ps		Sample of vertical writing.

include.pcf/		Directory containing header files for PCF fonts.
include.snf/		Directory containing header files for SNF fonts.


History
=======

gs23j10 (Oct. 4, 1991)
    Kanji package for Ghostscript version 2.3.

gs23j11 (Dec.24, 1991)

gs23j12 (Jan.17, 1992)


gs24j10 (May.15, 1992)
    Kanji package for Ghostscript version 2.4.1.

gs241j11 (Jul. 1, 1992)


gs261j01b (Aug.20, 1993)
    Kanji package for Ghostscript version 2.6.1. (beta version)

gs261j10 (Jan.11, 1994)
    Kanji package for Ghostscript version 2.6.1.


Patches
=======

bfont.h
  The prototype declaration of make_composite_font() and
  make_descender_fonts() are added.

gs_init.ps
  Base font operators are replaced with composite font operators.
  `kinit.ps' and `metrics2.ps' are invoked.

gs_fonts.ps
  The problem is fixed that the findfont operator leaves a font name
  in the stack when it is in QUIET mode and the font file is not found.
  
gschar.c
  gs_setcachedevice2() is adapted to the vertical writing.
  The vertical writing feature is implemented.
  gs_setrootfont() and gs_currentrootfont() are defined.

gschar.h
  The prototype declaration of gs_setrootfont() and gs_currentrootfont()
  are added.

gsfont.c
  The font cache is enlarged for the efficiency of Kanji fonts.
  The problem is fixed that composite fonts, which have no UniqueID,
  are cached by makefont.

gzstate.h
  rootfont is added into the graphics state.

zchar.c
  zrootfont() is changed to call gs_currentrootfont().

zfont.c
  zsetfont() is adapted to rootfont.
  make_font() calls make_composite_font() when it transforms composite
  fonts.
  make_composite_font() is defined.
	
zfont0.c
  zbuildfont0() is changed to call make_descender_fonts().
  make_descender_fonts() is defined.

zfont2.c
  A `fake UniqueID' facility is implemented to enhance the efficiency
  of the `makefont' cache.

gs.mak
  The features of composite fonts and Kanji fonts are added.

cc-head.mak
gcc-head.mak
ansihead.mak
  `$(gsdatadir)/kanji' is added to the GS_LIB_DEFAULT macro.
  `-DCOMPFONT -DWMODE -DKANJI' is added to the compilation flags.
  `kanji.dev kfpcf.dev kfsnf.dev kfzeit.dev kfztbez.dev kfjtex.dev' is
  added to the FEATURE_DEVS macro.

unixhead.mak
  The dependency `$(AK)' is removed from the implicit rule `.c.o'.

unixtail.mak
  The name of the output file is changed from `gs' to` $(GS)$(XE)'.

unix-cc.mak
unix-gcc.mak
unix-ansi.mak
  These files are updated according to the changes of gs.mak,
  cc-head.mak, gcc-head.mak, and ansihead.mak.
