PDFlib 8 Windows COM/.NET Tutorial
PDFlib 8 Windows COM/.NET Tutorial
PDFlib 8 Windows COM/.NET Tutorial
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Host encoding. The special encoding host does not have any fixed meaning, but will be<br />
mapped to another 8-bit encoding depending on the current platform as follows (see<br />
Table 4.2):<br />
> on IBM zSeries with MVS or USS it will be mapped to ebcdic;<br />
> on IBM i5/iSeries it will be mapped to ebcdic_37;<br />
> on <strong>Windows</strong> it will be mapped to winansi;<br />
> on all other systems (including Mac OS X) it will be mapped to iso8859-1;<br />
Host encoding is primarily useful for writing platform-independent test programs (like<br />
those contained in the <strong>PDFlib</strong> distribution) and other simple applications. Host encoding<br />
is not recommended for production use, but should be replaced by whatever encoding<br />
is appropriate.<br />
Automatic encoding. <strong>PDFlib</strong> supports a mechanism which can be used to specify the<br />
most natural encoding for certain environments without further ado. Supplying the<br />
keyword auto as an encoding name specifies a platform- and environment-specific 8-bit<br />
encoding for text fonts as follows:<br />
> On <strong>Windows</strong>: the current system code page (see below for details)<br />
> On Unix and Mac OS X: iso8859-1 (except LWFN PostScript fonts on the Mac for which<br />
auto will be mapped to macroman)<br />
> On IBM i5/iSeries: the current job’s encoding (IBMCCSID000000000000)<br />
> On IBM zSeries: ebcdic (=code page 1047).<br />
For symbol fonts the keyword auto is mapped to builtin encoding (see Section 5.4.2, »Selecting<br />
an Encoding for symbolic Fonts«, page 129). While automatic encoding is convenient<br />
in many circumstances, using this method will make your <strong>PDFlib</strong> client programs<br />
inherently non-portable.<br />
Encoding auto is used as the default encoding for Name strings (see Section 4.4.3,<br />
»Strings in non-Unicode-aware Language Bindings«, page 109) in non-Unicode-aware<br />
language bindings, since this is the most appropriate encoding for file names etc.<br />
User-defined 8-bit encodings. In addition to predefined encodings <strong>PDFlib</strong> supports<br />
user-defined 8-bit encodings. These are the way to go if you want to deal with some<br />
character set which is not internally available in <strong>PDFlib</strong>, such as EBCDIC character sets<br />
different from the one supported internally in <strong>PDFlib</strong>. <strong>PDFlib</strong> supports encoding tables<br />
defined by PostScript glyph names, as well as tables defined by Unicode values.<br />
The following tasks must be done before a user-defined encoding can be used in a<br />
<strong>PDFlib</strong> program (alternatively the encoding can also be constructed at runtime using<br />
encoding_set_char( )):<br />
> Generate a description of the encoding in a simple text format.<br />
> Configure the encoding in the <strong>PDFlib</strong> resource file (see Section 3.1.3, »Resource Configuration<br />
and File Search«, page 62) or via set_parameter( ).<br />
> Provide a font (metrics and possibly outline file) that supports all characters used in<br />
the encoding.<br />
The encoding file simply lists glyph names and numbers line by line. The following excerpt<br />
shows the start of an encoding definition:<br />
% Encoding definition for <strong>PDFlib</strong>, based on glyph names<br />
% name code Unicode (optional)<br />
space 32 0x0020<br />
102 Chapter 4: Unicode and Legacy Encodings (Edition for <strong>COM</strong>, .<strong>NET</strong>, and REALbasic)