17.05.2014 Views

PDFlib 8 Windows COM/.NET Tutorial

PDFlib 8 Windows COM/.NET Tutorial

PDFlib 8 Windows COM/.NET Tutorial

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

8-bit encodings are discussed in detail in Section 4.2, »Single-Byte (8-Bit) Encodings«,<br />

page 101. They can be pulled from various sources:<br />

> A large number of predefined encodings according to Table 4.2. These cover the most<br />

important encodings currently in use on a variety of systems, and in a variety of locales.<br />

> User-defined encodings which can be supplied in an external file or constructed dynamically<br />

at runtime with encoding_set_char( ). These encodings can be based on<br />

glyph names or Unicode values.<br />

> Encodings pulled from the operating system, also known as a system encoding. This<br />

feature is available on <strong>Windows</strong>, IBM iSeries and zSeries.<br />

The disadvantage of single-byte encodings is that only a limited set of characters and<br />

glyphs is available. For this reason complex script shaping and OpenType layout features<br />

are not supported for single-byte encodings.<br />

Builtin encoding. Among other scenarios, you can specify encoding=builtin to use single-byte<br />

codes for non-textual glyphs from symbolic fonts. The format of a font’s internal<br />

encoding depends on the font type:<br />

> TrueType: the encoding is created based on the font’s symbolic cmap, i.e. the (3, 0)<br />

entry in the cmap table.<br />

> OpenType fonts can contain an encoding in the CFF table.<br />

> PostScript Type 1 fonts always contain an encoding.<br />

> For Type 3 fonts the encoding is defined by the first 255 glyphs in the font.<br />

If the font does not contain any builtin encoding font loading fails (e.g. OpenType CJK<br />

fonts). You can use the symbolfont key in info_font( ) . If it returns false, the font is a text<br />

font which can also be loaded with one of the common single-byte encodings. This is<br />

not possible if the symbolfont key returns true. The glyphs in such symbolic fonts can<br />

only be used if you know the corresponding code for each glyph (see Section 5.4.2, »Selecting<br />

an Encoding for symbolic Fonts«, page 129).<br />

The disadvantage of encoding=builtin is that in single-byte encoded text character<br />

references cannot be used.<br />

Multi-byte encodings. This encoding type is supported for CJK fonts, i.e. TrueType and<br />

OpenType CID fonts with Chinese, Japanese, or Korean characters. A variety of encoding<br />

schemes has been developed for use with these scripts, e.g. Shift-JIS and EUC for Japanese,<br />

GB and Big5 for Chinese, and KSC for Korean. Multi-byte encodings are defined by<br />

the Adobe CMaps or <strong>Windows</strong> codepages (see Section 4.3, »Chinese, Japanese, and Korean<br />

Encodings«, page 105).<br />

These traditional encodings are only supported in non-Unicode-aware language<br />

bindings with the exception of Unicode CMaps which are equivalent to encoding=<br />

unicode.<br />

With multi-byte encodings the text will be written to the PDF output exactly as supplied<br />

by the user if the keepnative option is true.<br />

The disadvantage of multi-byte encodings is that <strong>PDFlib</strong> checks the input text only<br />

for valid syntax, but does not check whether a glyph for the supplied text is available in<br />

the font. Also, it is not possible to supply Unicode text since <strong>PDFlib</strong> cannot convert the<br />

Unicode values to the corresponding multi-byte sequences. Finally, character references,<br />

OpenType layout features and complex script shaping cannot be used.<br />

128 Chapter 5: Font Handling (Edition for <strong>COM</strong>, .<strong>NET</strong>, and REALbasic)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!