*** Printing Japanese document under Slackware-11.0 ***

If you are using Slackware with CJK language environment and wish to print CJK documents,
following info might be usefull.

But, I'm using Slackware only in Japanese environment and never tried Chinese and
Korean languages, so I'm not sure that info below is effective for printing Chinese or
Korean documents.

Anyway, here is how I did for printing Japanese document.



Slackware-11.0 uses espgs-8.15.3svn185 for printing.
As Pat said in his Changelog, the espgs-8.15.3svn185 supports CJK double-byte fonts.


However, a package espgs-8.15.3svn185 itself is not enough for printing Japanese document.
You need extra files shown in table below.

1. Ghostscript environment

fileHow to use files
 sample resource
FAPIcidfmap.cjk.sample
cidfmap.cjk.sample

These are just examples for my Japanese font setup.
You can find your own FAPIcidfmap and cidfmap in
/usr/share/ghostscript/8.15/lib/.

It's better to use Gentoo's original *.cjk for Chinese and Korean users.
ghostscript-esp-8.15.2-FAPIcidfmap.cjk(includes Chinese, Korean)
ghostscript-esp-8.15.2-cidfmap.cjk(includes Chinese, Korean)
extra filesghostscript-fonts-std-8.11.tar.gz
ghostscript-fonts-other-6.0.tar.gz
adobe-cmaps-200406.tar.gz
acro5-cmaps-2001.tar.gz

(I'm not sure adobe-cmaps and acro5-cmaps  are necessary.)

-------------------------------------------------------
Above tar.gz files can be found at below.
http://www.ring.gr.jp/pub/text/CTAN//support/ghostscript/fonts/
ftp://ftp.gyve.org/pub/gs-cjk/
# cd /usr/share/ghostscript
# tar xzvf /PATH-TO/ghostscript-fonts-std-8.11.tar.gz
# tar xzvf /PATH-TO/ghostscript-fonts-other-6.0.tar.gz

# cd /usr/share/ghostscript
# mkdir Resource
# cd Resource
# tar xzvf /PATH-TO/acro5-cmaps-2001.tar.gz
# tar xzvf /PATH-TO/adobe-cmaps-200406.tar.gz

symbolic linkCreate symbolic link to your real TTF directory at /usr/share/fonts/default/.
If a directory "/usr/share/fonts/default" doesn't exist, create
the directory with command
mkdir -p /usr/share/fonts/default
# cd /usr/share/fonts/default
# ln -s [PATH_TO_YOUR_TTF_DIR] TrueType
[ Notes for Chinese/Korean users ]
  Several files above links are specific configuration for Japanese font.
  PLS modify file so that it will fit your own font environment.


2. Test printing your Japanese documents
2-1. Firefox
     Visit any URL written in Japanese and print its web page.

2-3. AcrobatReader (version 7.0.8)
     In order to view and print PDF written in Japanese from acroread, you may need to
     install JAPAN FontPack. You can get it below.

     ftp://ftp.adobe.com/pub/adobe/reader/unix/7x/7.0.8/misc/FontPack708_jpn_i386-linux.tar.gz

2-3. Xpdf
     In order to view and print PDF written in Japanese from Xpdf, you need to install
     language support package for Xpdf.
     You can get xpdf-japanese.tar.gz at Xpdf homepage.
     
     Then make .xpdfrc at your HOME directory.
     Here is my sample .xpdfrc in case of sazanami-TTF.
#========================================================================
#
# Sample xpdfrc file
#
# The Xpdf tools look for a config file in two places:
# 1. ~/.xpdfrc
# 2. in a system-wide directory, typically /usr/local/etc/xpdfrc
#
# This sample config file demonstrates some of the more common
# configuration options. Everything here is commented out. You
# should edit things (especially the file/directory paths, since
# they'll likely be different on your system), and uncomment whichever
# options you want to use. For complete details on config file syntax
# and available options, please see the xpdfrc(5) man page.
#
# Also, the Xpdf language support packages each include a set of
# options to be added to the xpdfrc file.
#
# http://www.foolabs.com/xpdf/
#
#========================================================================

#----- display fonts

# These map the Base-14 fonts to standard X server fonts.
# These are default mappings, built into xpdf - they're shown here
# purely as examples.

#displayFontX Courier "-*-courier-medium-r-normal-*-%s-*-*-*-*-*-iso8859-1" Latin1
#displayFontX Courier-Bold "-*-courier-bold-r-normal-*-%s-*-*-*-*-*-iso8859-1" Latin1
#displayFontX Courier-BoldOblique "-*-courier-bold-o-normal-*-%s-*-*-*-*-*-iso8859-1" Latin1
#displayFontX Courier-Oblique "-*-courier-medium-o-normal-*-%s-*-*-*-*-*-iso8859-1" Latin1
#displayFontX Helvetica "-*-helvetica-medium-r-normal-*-%s-*-*-*-*-*-iso8859-1" Latin1
#displayFontX Helvetica-Bold "-*-helvetica-bold-r-normal-*-%s-*-*-*-*-*-iso8859-1" Latin1
#displayFontX Helvetica-BoldOblique "-*-helvetica-bold-o-normal-*-%s-*-*-*-*-*-iso8859-1" Latin1
#displayFontX Helvetica-Oblique "-*-helvetica-medium-o-normal-*-%s-*-*-*-*-*-iso8859-1" Latin1
#displayFontX Symbol "-*-symbol-medium-r-normal-*-%s-*-*-*-*-*-adobe-fontspecific" Symbol
#displayFontX Times-Bold "-*-times-bold-r-normal-*-%s-*-*-*-*-*-iso8859-1" Latin1
#displayFontX Times-BoldItalic "-*-times-bold-i-normal-*-%s-*-*-*-*-*-iso8859-1" Latin1
#displayFontX Times-Italic "-*-times-medium-i-normal-*-%s-*-*-*-*-*-iso8859-1" Latin1
#displayFontX Times-Roman "-*-times-medium-r-normal-*-%s-*-*-*-*-*-iso8859-1" Latin1
#displayFontX ZapfDingbats "-*-zapfdingbats-medium-r-normal-*-%s-*-*-*-*-*-*-*" ZapfDingbats

# These map the Base-14 fonts to the Type 1 fonts that ship with
# ghostscript. You'll almost certainly want to use something like
# this, but you'll need to adjust this to point to wherever
# ghostscript is installed on your system.

displayFontT1 Times-Roman /usr/share/ghostscript/fonts/n021003l.pfb
displayFontT1 Times-Italic /usr/share/ghostscript/fonts/n021023l.pfb
displayFontT1 Times-Bold /usr/share/ghostscript/fonts/n021004l.pfb
displayFontT1 Times-BoldItalic /usr/share/ghostscript/fonts/n021024l.pfb
displayFontT1 Helvetica /usr/share/ghostscript/fonts/n019003l.pfb
displayFontT1 Helvetica-Oblique /usr/share/ghostscript/fonts/n019023l.pfb
displayFontT1 Helvetica-Bold /usr/share/ghostscript/fonts/n019004l.pfb
displayFontT1 Helvetica-BoldOblique /usr/share/ghostscript/fonts/n019024l.pfb
displayFontT1 Courier /usr/share/ghostscript/fonts/n022003l.pfb
displayFontT1 Courier-Oblique /usr/share/ghostscript/fonts/n022023l.pfb
displayFontT1 Courier-Bold /usr/share/ghostscript/fonts/n022004l.pfb
displayFontT1 Courier-BoldOblique /usr/share/ghostscript/fonts/n022024l.pfb
displayFontT1 Symbol /usr/share/ghostscript/fonts/s050000l.pfb
displayFontT1 ZapfDingbats /usr/share/ghostscript/fonts/d050000l.pfb

# If you need to display PDF files that refer to non-embedded fonts,
# you should add one or more fontDir options to point to the
# directories containing the font files. Xpdf will only look at .pfa,
# .pfb, and .ttf files in those directories (other files will simply
# be ignored).

#fontDir /usr/local/fonts/bakoma

#----- PostScript output control

# Set the default PostScript file or command.

#psFile "|lpr -Pmyprinter"

# Set the default PostScript paper size -- this can be letter, legal,
# A4, or A3. You can also specify a paper size as width and height
# (in points).

#psPaperSize letter

#----- text output control

# Choose a text encoding for copy-and-paste and for pdftotext output.
# The Latin1, ASCII7, and UTF-8 encodings are built into Xpdf. Other
# encodings are available in the language support packages.

#textEncoding UTF-8

# Choose the end-of-line convention for multi-line copy-and-past and
# for pdftotext output. The available options are unix, mac, and dos.

#textEOL unix

#----- misc settings

# Set the anti-aliasing mode for t1lib and FreeType. These can be low
# or high (anti-aliasing), plain (no anti-aliasing), or none (disable
# the rasterizer entirely).

#t1libControl low
#freetypeControl low

# Set the command used to run a web browser when a URL hyperlink is
# clicked.

#urlCommand "netscape -remote 'openURL(%s)'"
#----- begin Cyrillic support package (2003-jun-28)
nameToUnicode /usr/X11R6/share/xpdf/cyrillic/Bulgarian.nameToUnicode
unicodeMap KOI8-R /usr/X11R6/share/xpdf/cyrillic/KOI8-R.unicodeMap
#----- end Cyrillic support package
#----- begin Latin2 support package (2002-oct-22)
unicodeMap Latin2 /usr/X11R6/share/xpdf/latin2/Latin2.unicodeMap
#----- end Latin2 support package
#----- begin Greek support package (2003-jun-28)
nameToUnicode /usr/X11R6/share/xpdf/greek/Greek.nameToUnicode
unicodeMap ISO-8859-7 /usr/X11R6/share/xpdf/greek/ISO-8859-7.unicodeMap
#----- end Greek support package
#----- begin Japanese support package (2004-jul-27)
cidToUnicode Adobe-Japan1 /usr/X11R6/share/xpdf/japanese/Adobe-Japan1.cidToUnicode
unicodeMap ISO-2022-JP /usr/X11R6/share/xpdf/japanese/ISO-2022-JP.unicodeMap
unicodeMap EUC-JP /usr/X11R6/share/xpdf/japanese/EUC-JP.unicodeMap
unicodeMap Shift-JIS /usr/X11R6/share/xpdf/japanese/Shift-JIS.unicodeMap
cMapDir Adobe-Japan1 /usr/X11R6/share/xpdf/japanese/CMap
toUnicodeDir /usr/X11R6/share/xpdf/japanese/CMap
#----- end Japanese support package
### use Kochi (Mincho) by default
displayCIDFontTT Adobe-Japan1 /usr/share/fonts/default/TrueType/sazanami-mincho.ttf
# use Kochi (Gothic) if gothic font is required
displayNamedCIDFontTT ShinGo-Bold /usr/share/fonts/default/TrueType/sazanami-gothic.ttf
displayNamedCIDFontTT ShinGo-regular /usr/share/fonts/default/TrueType/sazanami-gothic.ttf
displayNamedCIDFontTT MidashiGo-MB31 /usr/share/fonts/default/TrueType/sazanami-gothic.ttf
displayNamedCIDFontTT FutoGoB101-Bold /usr/share/fonts/default/TrueType/sazanami-gothic.ttf
displayNamedCIDFontTT HeiseiKakuGo-W5 /usr/share/fonts/default/TrueType/sazanami-gothic.ttf
displayNamedCIDFontTT HeiseiKakuGo-W9 /usr/share/fonts/default/TrueType/sazanami-gothic.ttf
displayNamedCIDFontTT HeiseiMaruGo-W4 /usr/share/fonts/default/TrueType/sazanami-gothic.ttf
displayNamedCIDFontTT MS-Gothic /usr/share/fonts/default/TrueType/sazanami-gothic.ttf
displayNamedCIDFontTT HG-GothicB /usr/share/fonts/default/TrueType/sazanami-gothic.ttf
displayNamedCIDFontTT Kochi-Gothic /usr/share/fonts/default/TrueType/sazanami-gothic.ttf
displayNamedCIDFontTT GothicBBB-Medium-H /usr/share/fonts/default/TrueType/sazanami-gothic.ttf
displayNamedCIDFontTT GothicBBB-Medium /usr/share/fonts/default/TrueType/sazanami-gothic.ttf
displayNamedCIDFontTT Ryumin-Light-H /usr/share/fonts/default/TrueType/sazanami-mincho.ttf
displayNamedCIDFontTT Ryumin-Light /usr/share/fonts/default/TrueType/sazanami-mincho.ttf

### make default font name to "Ryumin-Light" when converted to PostScript
psFont16 Adobe-Japan1 H Ryumin-Light-H ISO-2022-JP
psFont16 Adobe-Japan1 V Ryumin-Light-V ISO-2022-JP
# use "Gothic-BBB-Medium" if gothic font is required
psNamedFont16 MidashiGo-MB31 H GothicBBB-Medium-H ISO-2022-JP
psNamedFont16 MidashiGo-MB31 V GothicBBB-Medium-V ISO-2022-JP
psNamedFont16 FutoGoB101-Bold H GothicBBB-Medium-H ISO-2022-JP
psNamedFont16 FutoGoB101-Bold V GothicBBB-Medium-V ISO-2022-JP
psNamedFont16 HeiseiKakuGo-W5 H GothicBBB-Medium-H ISO-2022-JP
psNamedFont16 HeiseiKakuGo-W5 V GothicBBB-Medium-V ISO-2022-JP
psNamedFont16 HeiseiKakuGo-W9 H GothicBBB-Medium-H ISO-2022-JP
psNamedFont16 HeiseiKakuGo-W9 V GothicBBB-Medium-V ISO-2022-JP
psNamedFont16 HeiseiMaruGo-W4 H GothicBBB-Medium-H ISO-2022-JP
psNamedFont16 HeiseiMaruGo-W4 V GothicBBB-Medium-V ISO-2022-JP
psNamedFont16 MS-Gothic H GothicBBB-Medium-H ISO-2022-JP
psNamedFont16 MS-Gothic V GothicBBB-Medium-V ISO-2022-JP
psNamedFont16 HG-GothicB H GothicBBB-Medium-H ISO-2022-JP
psNamedFont16 HG-GothicB V GothicBBB-Medium-V ISO-2022-JP
psNamedFont16 Kochi-Gothic H GothicBBB-Medium-H ISO-2022-JP
psNamedFont16 Kochi-Gothic V GothicBBB-Medium-V ISO-2022-JP


2-4. a2ps
     If you wish to print Japanese text through a2ps, you need to rebuild a2ps with JP-patch.
     Get my a2ps-JP-src.tar.gz and make a2ps package as follows.
# tar xzvf a2ps-JP-src.tar.gz
# cd a2ps-JP-src
# slacktrack -j -k -p a2ps-4.13b-i486-1jp.tgz ./a2ps.build

     Then replace a2ps package to your new a2ps-4.13b-i486-1jp.tgz and print Japanese text from
     command line

     a2ps -R -1 -d <YOUR TEXT FILE>

     (extra memo) If you don't have a2ps-site.cfg at your /etc directory, here is my sample a2ps-site.cfg.
# a2ps-site.cfg                                           -*- Makefile -*-
#
# This file is included from a2ps.cfg
#

# In this file should be defined your specific values you want to keep
# for other installation (future) installation of a2ps.

#################################################################
# 1)    System dependent parameters                             #
#################################################################

# Default encoding
Options: --encoding=euc-jp

# Default medium
Options: --medium=letter
# Options: --medium=A4

#################################################################
# 2)    Your printers                                           #
#################################################################

# By default, produce Level 1 PostScript.
# Currently it only means to consider only the 13 level 1 standard
# fonts, and not the 35 standard level 2 fonts.
DefaultPPD: level1

# NOTE:
# Because sending a file to a printer is system dependent and because
# this file is meant to be system independent, there are two variables
# defined in a2ps.cfg you should use here.
# - #{lp.default}
#   Its value is typically `lp' or `lpr'.
# - #{lp}
#   Its value is typically `lp -d' or `lpr -P'.  Immediately after
#   #{lp} there should be the name of the printer.
#

### DefaultPrinter
# DefaultPrinter is the printer which is called upon `a2ps -d'.
DefaultPrinter: | #{lp.default}

### UnknownPrinter
# The `UnknownPrinter' is the command used when the user specified
# the name of the printer (a2ps -P <printer-name>), but <printer-name>
# is not specified below as a special case.
# <printer-name> is available here as `#o'.
UnknownPrinter: | #{lp} #o

### Some special printers.
# This section is to fill only if you want to tune your system.
# The entry `UnknownPrinter' is enough to handle any case.

# For instance, I want to specify that arlette is a Level 2 PostScript
# printer.  I specif no command, so the `UnknownPrinter' command will
# be used.
#Printer: arlette level2

# dominique is a level 2 PostScript _without_ Duplex support.
# Here I *want* a special command, not that of the UnknownPrinter.
# We use the shell script psmandup to simulate Duplex.
#Printer: dominique level2 | #?d#psmandup -n|## #{lp} dominique

# This is just to show that any command can be used.  Instead of
# printing, the output is piped in `wc'.
#Printer: wc | wc -l

# You can also save in a file if you wish.
#Printer: netscape >netscape.ps

# This example uses the fact that `$N' expands in the input file name,
# so a2ps foo -P gzip will save the output in foo.ps.gz.
#Printer: gzip | gzip -c > $N.#..gz



*** Brief results are as follows. ***
    Note : NG means that "CJK document can't be printed correctly".
           So, US/EU users don't have to be worry about it.
Package conbinationResult of
       printing Japanese document
espgs-7.07.1Works
espgs-8.15.2 (Slack official)NG
espgs-8.15.2 with CJK patchesWorks
espgs-8.15.3svn185Works
espgs-8.15.3Works
 Tested applications were xpdf, AcrobatReader, firefox, sylpheed, OpenOffice


Document made with Nvu  This page was edited by J_W (Shin-ichi Abe).

 
1