Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

DynaPDF Manual - Page 504

Previous Page 503   Index   Next Page 505

Function Reference
Page 504 of 750
One CMap file can be used with an arbitrary number of CID fonts. The function checks whether a
CMap was already loaded before it loads the same CMap again. A CMap specifies also the writing
mode. The style flag fsVerticalMode will be ignored when loading a font with an external CMap.
Return values:
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.
SI32 pdfLoadFont(
const PPDF* IPDF,
// Instance pointer
const void* Buffer, // Font file buffer
UI32 BufSize,
// Buffer size in bytes
TFStyle Style,
// Font style
double Size,
// Font size
LBOOL Embed,
// If true, the font will be embedded
TCodepage CP)
// 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
another one.
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

Previous topic: Working with External CMaps

Next topic: LoadFontEx