DynaPDF Manual - Page 552
Previous Page 551 Index Next Page 553
Page 552 of 821
If the function succeeds the return value is a CMap handle, a value greater or equal zero. If the
function fails the return value is a negative error code. The CMap handle is required to load a CID
font with this CMap.
const PPDF* IPDF,
// Instance pointer
const void* Buffer, // Font file buffer
// Buffer size in bytes
// Font style
// Font size
// If true, the font will be embedded
// Code page
The function loads a font from a file buffer and activates it in the graphics state if the function was
called within an open page or template. Supported font formats are TrueType, OpenType, and
Type1 fonts in PFB or PFA format.
It is also possible to load fonts directly from a font file with LoadFontEx(). This function is preferred
because it is more flexible and reduces the memory usage.
The function returns the font handle on success. The font handle is required whenever the font
should be set again with ChangeFont(), e.g. when opening a new page or if the font was changed to
The function does not check whether the font was already loaded in a previous call. The caller must
make sure that no unnecessary duplicates will be loaded. However, if the font should be used with
different code pages, a separate copy of the font is required for each code page.
The parameter Style sets the style flags fsUnderlined, fsStriked, or fsVerticalLayout only. It is also
possible to emulate font styles with manually loaded fonts. Use the function ChangeFontStyleEx() if
a font style should be emulated.
If the font name is known by the caller then it is also possible to set this font later with SetFont().
However, for proper behaviour manually loaded fonts should always be set with ChangeFont().
If SetFont() is used then there is no guarantee that the function loads exactly this font because the
function tries to load the best match according to the provided parameters.
Note that a font that was loaded with this function can only be used with the code page that was
used to load the font. If the code page must be changed then you must load a further copy of the
font. To reduce the memory usage, it is recommended to use LoadFontEx() instead, because this
function loads only required parts of the font file and it provides generally a better resource
Previous topic: Working with External CMaps
Next topic: TrueType Collections, LoadFontEx