Xojo Conferences

DynaPDF Manual - Page 505

Previous Page 504   Index   Next Page 506

Function Reference
Page 505 of 750
function loads only required parts of the font file and it provides generally a better resource
TrueType Collections
To enable access on a specific font of a TrueType Collection the 4 high bits of the parameter BufSize
are reserved for the font index. Index 0 through 15 can be encoded in this way (larger collections do
probably not exist). The whished font index must be combined with the buffer size as follows:
bufSize |= (index << 28);
// C/C++, C#
= bufSize or (index << 28)
// VB .Net
bufSize := bufSize or (index shl 28); // Delphi
If index < 8 Then
// Visual Basic
bufSize = bufSize Or (index * &H10000000)
bufSize = bufSize Or ((index And 7) * &H10000000) Or &H80000000
End If
Like all other fonts, manually loaded fonts are unloaded when the PDF file is closed or discarded
with FreePDF().
Return values:
If the function succeeds the return value is the font handle, a value greater or equal zero. If the
function fails the return value is a negative error code.
SI32 pdfLoadFontEx(
const PPDF* IPDF,
// Instance pointer
const char* FontFile, // Path to a font file
UI32 Index,
// Index of a TrueType Collection
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 font file 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.
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.
While LoadFont() loads a font always explicitely, this function performs a duplicate check before the
font is loaded. This enables a more efficient resource handling especially if a font must be loaded

Previous topic: LoadFont

Next topic: LockLayer