Tips on PostScript
Copyright (C) 2000-2002 Taiji Yamada <taiji@aihara.co.jp>
[Back] [Japanese Page]
<gs-cjk project>
Text filter into PostScript - tops
Distribution
Keywords
m2ps, coco, Emacs/Mule, iconv, lv, a2ps, mpage, gs-cjk
References
-
Adobe Systems Incorporated, ``Chapter 4 - Emulators and Translators,''
in ``PostScript Language Program Design,'' Addison-Wesley, pp. 59--75,
1988.
-
Adobe Systems Incorporated, ``Adobe Solutions Network: PostScript Technical
Notes,'' http://partners.adobe.com/asn/developer/technotes/postscript.html,
2000-2001.
Embed CIDFont/CMap into PostScript file - embresps
Distribution
Requirements
PostScript 3 printer, gs-cjk, CIDFontType0 fonts
On Ghostscript 6, let us use CJK(Chinese, Japanese,
Korean) TrueType fonts as CID-Keyed fonts
[2000/3/24] I made a patch to use CJK(Chinese:
PRC, Big5 or Unicode, Japanese: Shift-JIS or Unicode, Korean: Wansung,
Johab or Unicode) TrueType fonts as CID-Keyed fonts on Ghostscript 6, based
on this
site by Mr. Hideyuki Suzuki. The features of this patch for gs_ttf.ps
of GS 6 as follows:
-
Automatically detects the kind CID(CNS1, GB1, Japan1 or Korea1) by reading
some tables in a TrueType font
-
Uses a /Resource/TrueType/* file for an inverse map from CIDs to codes
of a TrueType font
-
[2000/4/17] Prepares vertically-oriented glyphs for vertically-used CIDs
by reading the GSUB table of a TrueType font
Patch and Resource/TrueType/* files
These resources are distributed under the BSD licnese.
-
Patch for GS - to use CJK TrueType fonts as CID-Keyed fonts and also to
prepare vertically-used CIDs by using GSUB table of TrueType fonts.
[2001/3/31] My works described in this
section have already moved to ``gs-cjk
project'' for gs6.50 or later. In gs-cjk project, we aim to add our
achievements to the original Aladdin/Artifex ghostscript.
-
Patch for GS 6.01 gs_ttf.ps
[2000/11/20] - gs_ttf.ps-cjkv-20001120.patch.gz
- Mr. Chih-Wei Huang and Mr. Hideyuki Suzuki reported a problem to me in
gs_ttf.ps.
Thanks a lot!
-
Put into /Resource/TrueType/ of GS 6.01
-
Obsolute Version by using Inverse of CMap(one column of cid2code.txt)
[2000/3/24,2000/11/22] - cjkvttcidmap-0.81.tar.gz
-
Bridge Version by using mapping tables of ftp.unicode.org
[2000/11/23,2000/12/16] - cjkvttcidmap-0.92.tar.gz
-
Bridge Version by using CMaps for PDF core fonts(ToUnicode CMap) of partners.adobe.com
[2001/12/16,2001/3/31] - cjkvttcidmap-0.935.tar.gz
-
Bridge Version by using CMaps for PDF core fonts(ToUnicode CMap) and mapping
tables of ftp.unicode.org
[2001/4/2] - cjkvttcidmap-0.94.tar.gz
and its generator written in Perl - [2001/3/31] - gen-cjkvttcidmap-20010402.tar.gz
-
Put into /Resource/ of GS 6.01 and use to
install CJK TrueType fonts
-
[2000/4/18,2000/12/16,2001/1/4] -
install-cid-20010208.tar.gz
includes simple shell scripts to install CID-Keyd fonts or CJK TrueType
fonts.
About the way to install TrueType fonts, please read the following sections.
How to change /Resource/ directory of Ghostscript
6
If you want to change /Resource directory to another one such
as /usr/local/share/ghostscript/Resource, please modify /GenericResourceDir
in gs_res.ps of GS 6 as follows:
/GenericResourceDir (/usr/local/share/ghostscript/Resource/)
readonly .forcedef
If you also want to change /Resource/Font directory, in the case
of GS 6.01, please modify /FontResourceDir in gs_res.ps
as follows:
/FontResourceDir (/usr/local/share/ghostscript/Resource/Font/)
readonly .forcedef
But, in the case of GS 6.0, modifying /FontResourceDir doesn't
work because gs_res.ps has a bug at about 670th line. The correct
code is 4 times 'pop' not 5 times as follows:
pop pop pop pop true exit
How to install CJK CID-Keyed fonts to Ghostscript
6
I explain how to install CID-Keyed fonts to GS 6.
First, please obtain following CMap files from ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/,
-
Taiwan - ac13.tar.Z(Adobe-CNS1)
-
China - ag13.tar.Z(Adobe-GB1)
-
Japan - aj14.tar.Z(Adobe-Japan1), aj20.tar.Z(Adobe-Japan2)
-
Korea - ak12.tar.Z(Adobe-Korea1)
-
others - ai0.tar.Z
and extract these archives in /Resource directory of GS. As an
example, I explain the case of ac13(Adobe-CNS1).
% cd /usr/local/share/ghostscript/Resource
% tar xvZf ac13.tar.Z
Please make /Resource/CMap directory and link CMap files to this
directory,
% mkdir CMap
% cd CMap
% ln -s ../ac13/CMap/* .
and make /Resource/CIDFont and /Resource/Font directories.
% cd /usr/local/share/ghostscript/Resource
% mkdir CIDFont
% mkdir Font
Next, obtain one of following CID-Keyed fonts from ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/samples/.
-
Taiwan: ac13(Adobe-CNS1)
-
MOEKai-Regular
-
MOESung-Regular
-
China: ag13(Adobe-GB1)
-
Japan: aj14(Adobe-Japan1)
-
WadaGo-Bold
-
WadaMaruGo-Regular
-
WadaMin-Bold
-
WadaMin-Regular
-
Japan: aj20(Adobe-Japan2) - JIS X 0212, Hojo Kanji
-
WadaMin-RegularH
-
WadaMaruGo-RegularH
-
Korea: ak12(Adobe-Korea1)
-
Munhwa-Bold
-
Munhwa-Regular
-
MunhwaGothic-Bold
-
MunhwaGothic-Regular
-
MunhwaGungSeo-Bold
-
MunhwaGungSeo-Light
-
MunhwaGungSeoHeulim-Bold
-
MunhwaGungSeoHeulim-Light
-
MunhwaHoonMin-Regular
As an example, I use a CID-Keyed font of Adobe-CNS1, ``MOEKai-Regular''.
Here, please get install-cid-*.tar.gz
which is a simple installer of CID-keyed fonts and extract this archive
in /Resource directory.
% cd /usr/local/share/ghostscript/Resource
% tar xvzf install-cid-20010208.tar.gz
To apply all CMap resources of Adobe-CNS1 to MOEKai-Regular, please
try to execute as follows:
% ac13.sh install MOEKai-Regular
then, all resource files are automatically generated in /Resource/Font
directory. One of /Resource/Font/MOEKai-Regular-* is shown as
follows:
%!PS-Adobe-3.0 Resource-Font
%%DocumentNeededResources: ETen-B5-H (CMap)
%%IncludeResource: ETen-B5-H (CMap)
%%BeginResource: Font (MOEKai-Regular-ETen-B5-H)
/MOEKai-Regular-ETen-B5-H
/ETen-B5-H /CMap findresource
[/MOEKai-Regular /CIDFont findresource]
composefont pop
%%EndResource
%%EOF
Now, on GS 6, you can use /MOEKai-Regular-ETen-B5-H, /MOEKai-Regular-UniCNS-UCS2-H
and so on.
How to uninstall CJK CID-Keyed fonts
To delete generated files, please command as follows:
% ac13.sh uninstall MOEKai-Regular
How to install CJK TrueType fonts to Ghostscript
6
I explain how to install CJK TrueType fonts to GS 6. The way described
in this section requires the patch and resource files introduced in the
top of this page. Please extract the resource files in /Resource/TrueType
as follows:
% cd /usr/local/share/ghostscript/Resource
% mkdir TrueType
% cd TrueType
% tar xvzf cjkvttcidmap-0.92.tar.gz
First, please be guided by procedures described in ``How
to install CJK CID-Keyed fonts to Ghostscript 6'' until preparing a
simple installer of CID fonts, install-cid-*.tar.gz.
Next, I explain about a TrueType font used in Taiwan, ``Abig5.ttf''
in /usr/local/share/fonts/truetype as an example.
To build a CID-Keyed font from a TrueType font and apply all CMap resources
of Adobe-CNS1 to the generated CIDFont resource, please try to execute
as follows:
% cd /usr/local/share/ghostscript/Resource
% alias-ac13.sh install AcademyBIG5=Abig5.ttf
then, /Resource/CIDFont/AcademyBIG5 is generated and is shown
as follows:
%!PS-Adobe-3.0 Resource-CIDFont
%%BeginResource: CIDFont (AcademyBIG5)
/AcademyBIG5
(/usr/local/share/fonts/truetype/Abig5.ttf) .openttcidfont
dup length dict begin {def} forall currentdict end
/CIDFont defineresource pop
%%EndResource
%%EOF
and all resource files are also generated in /Resource/Font directory
by internally using ac13.sh in alias-ac13.sh. One of
/Resource/Font/AcademyBIG5-*
is shown as follows:
%!PS-Adobe-3.0 Resource-Font
%%DocumentNeededResources: CNS1-H (CMap)
%%IncludeResource: CNS1-H (CMap)
%%BeginResource: Font (AcademyBIG5-CNS1-H)
/AcademyBIG5-CNS1-H
/CNS1-H /CMap findresource
[/AcademyBIG5 /CIDFont findresource]
composefont pop
%%EndResource
%%EOF
Now, on GS 6, you can use /AcademyBIG5-CNS1-H, /AcademyBIG5-UniCNS-UCS2-H,
and so on.
How to uninstall CJK TrueType fonts
To delete generated files, please command as follows:
% alias-ac13.sh uninstall AcademyBIG5
Usages of alias-*.sh
Direct the kind of CID in a font name not to automatically
detect from a TrueType font
% alias-ac13.sh install Arial-Adobe-CNS1=arialuni.ttf
Designate an index of a TTC(TrueType Collection) font
% alias-ag13.sh install NSimSun=simsun.ttc,2
Name alias ``Ryumin-Light'' a CID-keyed font ``MS-Mincho''
% alias-aj14.sh install Ryumin-Light=MS-Mincho
Designate an inverse map not to automatically detect from a TrueType
font
% alias-aj14.sh install FA-Gothic,Adobe-Japan1-Unicode=FANGOT5.TTC
Install more than one font
% alias-ak12.sh install Batang=batang.ttc BatangChe=batang.ttc,2
PostScript examples for testing
Simple CJK PostScript files for testing
CJK PostScript files for detailed test
-
CID ordering, all glyphs (cf. Technical Notes of #5080, 5079, 5078, 5097
and 5093 at Adobe
Solutions Network) These PostScript files are
available for GS 6.50 or later. [2001/1/25, 2001/11/17 Updated]
-
ISO-2022 base, CJK code
This PostScript file doesn't work on GS 6.50,
Mr. Toshiya Suzuki at gs-cjk@gyve.org investigated the cause of this problem
and solved it by his ``multi-dimensional range comparator'' on GS 6.50
or later.
-
EUC base encodings
-
CJK Venders encodings
-
Unicode table of CJK
-
CID to Code Duplicated glyphs [PS file] [Screen
Shot Page 1] [Page 2]
-
Vertically-used glyphs [PS file] [Screen
Shot]
-
All glyphs of gap in CID-Code space with CJK TrueType fonts
Encodings of CID-Keyed fonts with CJK TrueType
fonts
-
ISO-2022 base
-
Taiwan, a part of CNS 11643 Plain-1 (0x4421-)
-
Taiwan, a part of CNS 11643 Plain-2 (0x4121-)
-
China, a part of GB 2312 (17-ku)
-
China, a part of GB/T 12345 (17-ku)
-
Japan, a part of JIS X 0208 (17-ku)
-
Japan, a part of JIS X 0212 (17-ku)
-
Korea, a part of KS X 1001 (17-gyou)
-
Vendor Encoding
-
Unicode(these are printed by using some CJK fonts with a priority order
of Korea1, Japan2, Japan1, GB1, CNS1)
Questions or comments regarding this service? taiji@aihara.co.jp.
Copyright (C) 2000-2002 Taiji Yamada, All rights reserved.