DynaPDF Manual - Page 697
Previous Page 696 Index Next Page 698
Function Reference
Page 697 of 839
determines the CID number for each glyph. Each CID-keyed font explicitly references the character
collection on which its CID numbers are based.
A CMap (character map) file specifies the correspondence between character codes and the CID
numbers used to identify glyphs. It is equivalent to the concept of an encoding in simple fonts.
Whereas a simple font allows a maximum of 256 glyphs to be encoded and accessible at one time, a
CMap can describe a mapping from multiple-byte codes to thousands of glyphs in a large CID-
keyed font. For example, it can describe Shift-JIS, one of several widely used encodings for Japanese.
See also LoadCMap().
The supported character collection of a CID-keyed font must match the one of the CMap file. If the
CMap file provides a mapping into another character collection as the font supports, then the
function returns with an error and the font will not be loaded.
Although TrueType fonts have no native notation of CIDs it is also possible to use TrueType fonts
with external CMaps as long as the font contains a CMap in the format 0, 4, 6, 10, or 12. TrueType
fonts which contain only a CMap in format 2 cannot be used with external CMap files (format 2 is a
mixed 8/16 bit encoding that is supported in certain pure CJK fonts). However, such fonts can be
loaded with SetFont().
A key feature of the CID-keyed font architecture is that it works also with non-embedded fonts. Due
the predefined character collections it is possible to display the text also if the font is not available on
the system.
Documents in western writing systems use about 80 through 100 glyphs of a font on average, while
Asian documents use often more than 400 through several thousand glyphs in one document. The
amount of font data that must be stored in Asian documents is not comparable with western
documents.
Although font embedding is still recommended, the amount of data is sometimes too large to embed
all fonts. If font embedding is not possible it is recommended to use fonts which are probably
available on the user's operating system.
Please note that DynaPDF knows nothing about the encoding when using a font with an external
CMap. Functions which output formatted text like WriteFText() can only be used with CMaps
which map Unicode (UTF-16) to CIDs. The wide string version of the function must be used in this
case.
Word Spacing
Word spacing applies to the space character of a string. However, most CJK encodings support
more than one space character, such as a proportional space, ideographic space, full width space,
half width space and many more. DynaPDF treats always CID 1 as space character, independent of
the used character collection. All other CIDs are treated as ordinary glyphs.
Previous topic: SetCheckBoxState, SetCIDFont
Next topic: Vertical Writing Mode, Encodings Identity-H and Identity-V