DynaPDF Manual - Page 533

Previous Page 532   Index   Next Page 534

Function Reference
Page 533 of 787
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 wished font index must be combined with the buffer size as follows:
bufSize |= (index << 28);
// C/C++, C#
bufSize
= bufSize or (index << 28)
// VB .Net
bufSize := bufSize or (index shl 28); // Delphi
If index < 8 Then
// Visual Basic
bufSize = bufSize Or (index * &H10000000)
Else
bufSize = bufSize Or ((index And 7) * &H10000000) Or &H80000000
End If
Remarks:
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.
LoadFontEx
Syntax:
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
with different code pages. The function compares the absolute file path and not the font name.
Therefore, it is strongly recommended to load fonts always from the same directories.
 

Previous topic: LoadFont

Next topic: LoadFDFData

Start Chat