DynaPDF Manual - Page 568

Previous Page 567   Index   Next Page 569

Function Reference
Page 568 of 860
Font selection in EMF files
When selecting a font with the GDI function CreateFont(), the GDI selects a font that is a good
match in comparison to the used parameters. The highest search priority has the Charset, followed
by PitchAndFamily. If one of these parameters are not supported by the requested font, then the
GDI selects an arbitrary other font that represents a better match.
To get a close match to what the GDI would select, the flag mfGDIFontSelection can be set (see
SetMetaConvFlags() for further information). DynaPDF uses then a device context to select fonts.
This produces often better results since many EMF files use invalid font names or other invalid
parameters.
In general, DynaPDF checks whether the requested glyphs are available in the font. If one or more
glyphs are missing then the selected font will be loaded in Unicode mode if it was loaded with a
code page. If still glyphs are missing then the font will be changed to Arial Unicode MS. This
fallback was mainly added for Asian EMF files which use often wrong charsets or fonts which do
not support Asian characters.
Character sets
The charset parameter of a CreateFont() function should be set correctly so that DynaPDF can
directly load a font with the required code page or Unicode:
Ansi_CHARSET: The font will be loaded with the code page 1252. This saves disk space
because Ansi strings require only one byte per character. However, if the same font must
also be used with other encodings then use DEFAULT_CHARSET instead.
DEFAULT_CHARSET: The font is directly loaded in Unicode mode. This charset must be
used for any non-Latin charset.
SYMBOL_CHARSET: This charset must be used for symbol fonts. Symbol codes start at
0xF000. The mapping in EMF file is often wrong. DynaPDF corrects this automatically.
All other character sets are treated in Unicode mode. EMF files do not contain strings in
other encodings.
For Asian EMF files it is recommended but not required to set the flag mfUseUnicode. This
flag makes sure that a font will not be loaded with the code page 1252 which is mostly not
meaningful in Asian EMF files. It slightly improves the processing speed if a file contains
many create font records with invalid charset information.
Non-portable WMF files
Two WMF file formats are available, the old non-portable WMF format and the newer portable
WMF format. Both formats are converted to EMF before they can be converted to PDF. DynaPDF
uses the Windows API function SetWinMetaFileBits() to convert WMF files. Because of this, WMF
files are not supported on Mac OS X, Linux or UNIX.
 

Previous topic: InsertMetafile, Bounding box check, How to calculate the image size?

Next topic: Portable WMF files