Re: Improve documentation for CID fonts

"Russell Lang" <[email protected]> Thu, 28 Oct 2004 19:15:21 +1000
Newsgroups gmane.comp.printing.ghostscript.patches
Message-ID <41814549.15368.11DE2207@localhost>
Igor,

Here is an updated patch.  Please check that I haven't changed the 
meaning of your text.

Log message:
Improve documentation for CID fonts.

_______________________________________________
gs-code-review mailing list
[email protected]
http://www.ghostscript.com/mailman/listinfo/gs-code-review
cjkdoc3.txt (application/octet-stream, 14.6 KB)
--- l:/cvs/gs/doc/Use.htm	Thu Oct 28 08:08:00 2004
+++ doc/Use.htm	Thu Oct 28 08:16:52 2004
@@ -50,9 +50,10 @@
 <ul>
 <li><a href="#PS_resources">Finding PostScript Level 2 resources</a>
 <li><a href="#Font_lookup">Font lookup</a>
+<li><a href="#CIDFonts">CID fonts</a>
+<li><a href="#CIDFontSubstitution">CID font substitution</a>
 <li><a href="#Temp_files">Temporary files</a>
 </ul>
-<li><a href="#CIDFontSubstitution">CID font substitution</a>
 
 <li><a href="#Platforms">Notes on specific platforms</a>
 <ul>
@@ -773,13 +774,13 @@
 
 <p>
 Adobe specifies that resources are installed in a single directory.
-Instead that, Ghostscript maintains a list of resource directories,
+Ghostscript instead maintains a list of resource directories,
 and uses an extended method for finding resource files.
 
 <p>
-The search of a resource file depends on whether
+The search for a resource file depends on whether
 the value of the system parameter <b><tt>GenericResourceDir</tt></b>
-specifies an absolute path. The user may set it how explained in
+specifies an absolute path. The user may set it as explained in
 <a href="#Resource_related_parameters">Resource-related parameters</a>.
 
 <p>
@@ -793,7 +794,7 @@
 
 <p>
 If the value of the system parameter <b><tt>GenericResourceDir</tt></b>
-is an absolute path (it is so by default), 
+is an absolute path (the default), 
 Ghostscript assumes a single resource directory.
 It concatenates :
 
@@ -838,17 +839,16 @@
 <b><tt>GenericResourcePathSep</tt></b> (initially
 "<b><tt>/</tt></b>" on Unix and Windows, "<b><tt>:</tt></b>" on MacOS,
 "<b><tt>]</tt></b>" on OpenVMS).
-Also string <b><tt>./Resource</tt></b> is replaced with a
+The string <b><tt>./Resource</tt></b> is replaced with a
 platform dependent equivalent. 
 
 <p>
 In the case of multiple resource directories,
 the default <b><tt>ResourceFileName</b></tt> procedure retrieves either a path 
-to the first avaliable resource,
-or a path starting with <b><tt>GenericResourceDir</tt></b>,
-if the resource is not available.
-Due to that Postscript installers of Postscript resources
-will overvrite an existing resource or add into the first resource directory.
+to the first avaliable resource, or if the resource is not available it
+returns a path starting with <b><tt>GenericResourceDir</tt></b>.
+Consequently Postscript installers of Postscript resources
+will overwrite an existing resource or add it to the first resource directory.
 
 <p>
 To look up fonts, after exhausting the search method described in <a href="#Font_lookup">the
@@ -863,7 +863,7 @@
 </ol>
 
 <p>
-Note that even though the system parameters are named "somethingDir", they
+Note that even although the system parameters are named "somethingDir", they
 are not just plain directory names: they have "<b><tt>/</tt></b>" on the
 end, so that they can be concatenated with the category name or font name.
 
@@ -873,7 +873,7 @@
 Ghostscript has a slightly different way to find the file containing a font
 with a given name.  This rule uses not only the search path defined by
 <b><tt>-I</tt></b>, <b><tt>GS_LIB</tt></b>, and
-<b><tt>GS_LIB_DEFAULT</tt></b> <a href="#General_search_path">as described
+<b><tt>GS_LIB_DEFAULT</tt></b> <a href="#Finding_files">as described
 above</a>, but also the directory that is the value of the
 <b><tt>FontResourceDir</tt></b> system parameter, and an additional list of
 directories that is the value of the <b><tt>GS_FONTPATH</tt></b> environment
@@ -937,9 +937,8 @@
 </ul>
 
 <p>
-Loading truetype fonts directly from <tt>/Resource/CIDFont/</tt> is not
-supported. A <a href="#CIDFontSubstitution"><tt>cidfmap</tt></a> entry
-must be created instead to provide a proper character ordering for the font.
+<a href="#CIDFonts">CID fonts</a> (e.g. Chinese, Japanese and Korean) 
+are found using a different method.
 
 <blockquote><table cellpadding=0 cellspacing=0>
 <tr><th colspan=3 bgcolor="#CCCC00"><hr><font size="+1">Differences between search path and font path</font><hr>
@@ -1092,54 +1091,19 @@
 about a megabyte of disk space, but the installation documentation explains
 how to do it <a href="Install.htm#Use_Acrobat_fonts_Unix">on Unix</a>.
 
-<h3><a name="Temp_files"></a>Temporary files</h3>
-
-<blockquote><table cellpadding=0 cellspacing=0>
-<tr><th colspan=5 bgcolor="#CCCC00"><hr><font size="+1">Where Ghostscript puts temporary files</font><hr>
-<tr valign=bottom>
-	<th align=left>Platform
-	<td>&nbsp;&nbsp;&nbsp;
-	<th align=left>Filename
-	<td>&nbsp;&nbsp;&nbsp;
-	<th align=left>Location
-<tr>	<td colspan=5><hr>
-<tr valign=top>	<td>MS Windows and OpenVMS
-	<td>&nbsp;
-	<td><b><tt>_temp_</tt></b>XX.XXX
-	<td>&nbsp;
-	<td>Current directory
-<tr valign=top>	<td>OS/2
-	<td>&nbsp;
-	<td><b><tt>gs</tt></b>XXXXXX
-	<td>&nbsp;
-	<td>Current directory
-<tr valign=top>	<td>Unix
-	<td>&nbsp;
-	<td><b><tt>gs_</tt></b>XXXXX
-	<td>&nbsp;
-	<td><b><tt>/tmp</tt></b>
-</table></blockquote>
-
-<p>
-You can change in which directory Ghostscript creates temporary files by
-setting the <b><tt>TMPDIR</tt></b> or <b><tt>TEMP</tt></b> environment
-variable to the name of the directory you want used.  Ghostscript currently
-doesn't do a very good job of deleting temporary files if it exits because
-of an error; you may have to delete them manually from time to time.
-
-<h2><a name="CIDFontSubstitution"></a>CID font substitution</h2>
+<h3><a name="CIDFonts"></a>CID fonts</h2>
 
 <p>
-CID fonts are PostScript resources containing
-large number of glyphs (e.g. glyphs for Far East languages).
+CID fonts are PostScript resources containing a
+large number of glyphs (e.g. glyphs for Far East languages,
+Chinese, Japanese and Korean).
 Please refer to the PostScript Language Reference,
 third edition, for details.
 
-
 <p>
-CID font resources are a different kind of PostScript resources from fonts.
-Particularly they cannot be used as regular fonts.
-CID font resources must first to be combined with a CMap resource, which
+CID font resources are a different kind of PostScript resource from fonts.
+In particular, they cannot be used as regular fonts.
+CID font resources must first be combined with a CMap resource, which
 defines specific codes for glyphs, before it can be used as a font. This 
 allows the reuse of a collection of glyphs with different encodings.
 
@@ -1156,13 +1120,22 @@
 Another method is possible using the <b><tt>composefont</tt></b> operator.
 
 <p>
-For substituting CID font resources Ghostscript provides the control file
-<b><tt>lib/cidfmap</tt></b>, which defines a CID font resource map.
+CID fonts must be placed in the <b><tt>/Resource/CIDFont/</tt></b> directory.
+They are not found using <a href="#Font_lookup">Font lookup</a>
+on the search path or font path.
+
+<h3><a name="CIDFontSubstitution"></a>CID font substitution</h3>
+
+<p>
+
+<p>
+Substitution of CID font resources is controlled by the Ghostscript
+configuration file <b><tt>lib/cidfmap</tt></b>, 
+which defines a CID font resource map.
 The file forms a table of records, each of which should use one of two formats,
 explained below.
 
-<p> For substituting a CID font resource to another CID font resource
-a record is a simple pair of names:
+<p> To substitute a CID font resource with another CID font resource:
 
 <blockquote><b><tt>
 /Substituted /Original ;
@@ -1171,38 +1144,39 @@
 by a document, and <b><tt>Original</tt></b> is a name of an available
 CID font resource. Please pay attention that both them must be
 designed for same character collection. In other words, you
-cannot substitute Japanese CID font resource to Korean CID font resource,
+cannot substitute a Japanese CID font resource with a Korean CID font resource,
 etc. CMap resource names must not appear in
 <b><tt>lib/cidfmap</tt></b>. The trailing semicolon and the space before it
 are both required.
 
 <p>
 
-For substituting a TrueType font to a CID font one should use format like this :
+To substitute a CID font resource with a TrueType font:
 
 <blockquote><b><tt>
-/Substituted << keys&values >> ;
+/Substituted &lt;&lt; keys&amp;values &gt;&gt; ;
 </tt></b></blockquote>
 
-Where <b><tt>keys&values</tt></b> are explained in the table below.
+Where <b><tt>keys&amp;values</tt></b> are explained in the table below.
 
 <table cellpadding=0 cellspacing=10>
 
 <tr>	<th>Key
 	<th>Type
 	<th>Description
-<tr>	<td><tt>/Path</tt>
+<tr>	<td><b><tt>/Path</tt></b>
         <td>string
-        <td>A path to a TrueType font file.
-<tr>	<td><tt>/FileType</tt>
+        <td>A path to a TrueType font file.  This must be an absolute path.
+<tr>	<td><b><tt>/FileType</tt></b>
         <td>name
         <td>Must be <b><tt>/TrueType</tt></b>.
-<tr>	<td><tt>/SubfontID</tt>
+<tr>	<td><b><tt>/SubfontID</tt></b>
         <td>integer
         <td>(optional) Index of the font in font collection, such as TTC.
-            This is ignored if Path doesn't specify a collection.
+            This is ignored if <b><tt>Path</tt></b> doesn't specify a collection.
+            The first font in a collection is 1.
             Default value is 0.
-<tr>	<td><tt>/CSI</tt>
+<tr>	<td><b><tt>/CSI</tt></b>
         <td>array of 2 elements
         <td>(required) Information for building <b><tt>CIDSystemInfo</tt></b>.
             The first element is a string, which specifies <b><tt>Ordering</tt></b>.
@@ -1211,7 +1185,7 @@
 
 <p>
 Currently only CIDFontType 2 can be emulated with a TrueType font.
-The TrueType font must contain enough charasters to cover an
+The TrueType font must contain enough characters to cover an
 Adobe character collection, which is specified in <b><tt>Ordering</tt></b>.
 
 <p>
@@ -1219,22 +1193,34 @@
 
 
 <blockquote><b><tt>
-/Ryumin-Medium  /ShinGo-Bold ;
-</tt></b></blockquote>
-<blockquote><b><tt>
-/Ryumin-Light   << /FileType /TrueType /Path (F:/WIN2000/Fonts/ARIALUNI.TTF) /SubfontID 3 /CSI [(Japan1) 2] >> ;
+/Ryumin-Medium  /ShinGo-Bold ;<br>
+/MS-Mincho &lt;&lt; /FileType /TrueType /Path (C:/WINDOWS/fonts/msmincho.ttc) /SubfontID 1 /CSI [(Japan1) 3] &gt;&gt; ;<br>
+/Ryumin-Light /MS-Mincho ;<br>
+<br>
+/Batang &lt;&lt; /FileType /TrueType /Path (C:/WINDOWS/fonts/batang.ttc) /SubfontID 1 /CSI [(Korea1) 3] &gt;&gt; ;<br>
+/Gulim &lt;&lt; /FileType /TrueType /Path (C:/WINDOWS/fonts/gulim.ttc) /SubfontID 1 /CSI [(Korea1) 3] &gt;&gt; ;<br>
+/Dotum &lt;&lt; /FileType /TrueType /Path (C:/WINDOWS/fonts/gulim.ttc) /SubfontID 3 /CSI [(Korea1) 3] &gt;&gt; ;<br>
+/HYSMyeongJo-Medium /Batang ;<br>
+/HYRGoThic-Medium /Gulim ;<br>
+/HYGoThic-Medium /Dotum ;<br>
+<br>
+/SimSun &lt;&lt; /FileType /TrueType /Path (C:/WINDOWS/fonts/simsun.ttc) /SubfontID 1 /CSI [(GB1) 2] &gt;&gt; ;<br>
+/SimHei &lt;&lt; /FileType /TrueType /Path (C:/WINDOWS/fonts/simhei.ttf) /SubfontID 0 /CSI [(GB1) 2] &gt;&gt; ;<br>
+/STSong-Light /SimSun ;<br>
+/STHeiti-Regular /SimHei ;<br>
 </tt></b></blockquote>
 
 <p>
-Note that loading truetype fonts directly from /Resources/CIDFont is no longer
-supported. There is no reliable way to generate a character ordering for truetype
+Note that loading truetype fonts directly from 
+<b><tt>/Resources/CIDFont</tt></b> is no longer supported. 
+There is no reliable way to generate a character ordering for truetype
 fonts. The 7.0x versions of Ghostscript supported this by assuming a Japanese
 character ordering. This is replaced in the 8.0x and later releases with the more
 general <b><tt>cidfmap</tt></b> mechanism.
 
 <p>
-Rather the PDF specification requires CID font files to be embedded,
-some documents miss them. As a workaround
+The PDF specification requires CID font files to be embedded,
+however some documents omit them. As a workaround
 the PDF interpreter applies an additional substitution method when 
 a requested CID font resource is not embedded and it is not available.
 It takes values of the keys <b><tt>Registry</b></tt> and <b><tt>Ordering</b></tt>
@@ -1242,7 +1228,7 @@
 and concatenates them with a dash inserted.
 For example, if a PDF CID font resource specifies 
 <blockquote><b><tt>
-/CIDSystemInfo << /Registry (Adobe) /Ordering (CNS1) /Supplement 1 >>
+/CIDSystemInfo &lt;&lt; /Registry (Adobe) /Ordering (CNS1) /Supplement 1 &gt;&gt;
 </tt></b></blockquote>
 the generated subsitituite name is <b><tt>Adobe-CNS1</b></tt>.
 The latter may look some confusing for a font name,
@@ -1252,21 +1238,55 @@
 
 <p>
 Please note that when a PDF font resource specifies
-<blockquote><b><tt>
-/Registry (Adobe) /Ordering (Identity),
+<blockquote><b><tt> 
+/Registry (Adobe) /Ordering (Identity)
 </tt></b></blockquote>
 there is no way to determine the language properly.
-Therefore in this case, if the CID font file is not embedded,
-the <b><tt>Adobe-Identity</b></tt> record depends on document,
-and a correct record isn't possible when
-a document refers multiple Far East languages.
+If the CID font file is not embedded, the <b><tt>Adobe-Identity</b></tt> 
+record depends on the document and a correct record isn't possible when
+a document refers to multiple Far East languages.
 In the latter case add individual records for specific CID font names.
 
 <p>
 Consequently, if you want to handle any PDF document with 
 non-embedded CID fonts (which isn't a correct PDF),
-you need to create <b><tt>lib/cidfmap</tt></b> dynamicly
-with a human interaction.
+you need to create a suitable <b><tt>lib/cidfmap</tt></b> by hand.
+
+<h3><a name="Temp_files"></a>Temporary files</h3>
+
+<blockquote><table cellpadding=0 cellspacing=0>
+<tr><th colspan=5 bgcolor="#CCCC00"><hr><font size="+1">Where Ghostscript puts temporary files</font><hr>
+<tr valign=bottom>
+	<th align=left>Platform
+	<td>&nbsp;&nbsp;&nbsp;
+	<th align=left>Filename
+	<td>&nbsp;&nbsp;&nbsp;
+	<th align=left>Location
+<tr>	<td colspan=5><hr>
+<tr valign=top>	<td>MS Windows and OpenVMS
+	<td>&nbsp;
+	<td><b><tt>_temp_</tt></b>XX.XXX
+	<td>&nbsp;
+	<td>Current directory
+<tr valign=top>	<td>OS/2
+	<td>&nbsp;
+	<td><b><tt>gs</tt></b>XXXXXX
+	<td>&nbsp;
+	<td>Current directory
+<tr valign=top>	<td>Unix
+	<td>&nbsp;
+	<td><b><tt>gs_</tt></b>XXXXX
+	<td>&nbsp;
+	<td><b><tt>/tmp</tt></b>
+</table></blockquote>
+
+<p>
+You can change in which directory Ghostscript creates temporary files by
+setting the <b><tt>TMPDIR</tt></b> or <b><tt>TEMP</tt></b> environment
+variable to the name of the directory you want used.  Ghostscript currently
+doesn't do a very good job of deleting temporary files if it exits because
+of an error; you may have to delete them manually from time to time.
+
 
 <hr>
 
@@ -2219,7 +2239,7 @@
 The value is platform dependent. It must end with a directory separator.
 <p>
 Adobe specifies <b><tt>GenericResourceDir</tt></b> to be an absolute path
-to a single resource directory. Instead that, Ghostscript maintains
+to a single resource directory. Ghostscript instead maintains
 multiple resource directories and uses an extended method for finding
 resources, which is explained in  
 <a href="PS_resources">"Finding PostScript Level 2 resources"</a>.