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

DynaPDF Manual - Page 304

Previous Page 303   Index   Next Page 305

Function Reference
Page 304 of 750
EnumHostFonts
Syntax:
SI32 pdfEnumHostFonts(
const PPDF* IPDF,
// Instance pointer
const void* Data,
// User defined pointer
TEnumFontProc* EnumProc) // Callback function see below
typedef SI32 PDF_CALL TEnumFontProc(
const void* Data,
// User defined pointer
const UI16* FamilyName,
// Family name of the font (Unicode)
const char* PostScriptName, // PostScript name of the font
SI32 Style);
// Font style (bold, italic, bold+italic)
#define PDF_CALL __stdcall
// Windows only, otherwise empty
This function enumerates all fonts found in the search directories by passing the font names to a
callback function. If the parameter EnumProc is NULL the function returns the number of available
font files which are found in the search directories. This is may be not the number of font files which
are returned by the callback function!
Fewer fonts can be enumerated if the search directories contain invalid font files. However, it is also
possible that more fonts are enumerated as font files were found!
This can happen if TrueType Collection font files are stored in the search directories. Such fonts
contain more than one font in a font file, so that the number of fonts can be greater than the number
of font files. If the font names should be stored in an array you must make sure that memory can be
reallocated if the number of fonts exceeds the number of font files.
The font names passed to the callback function are null-terminated and sorted in ascending order by
PostScript name. Note that the family name is in Unicode format. The user defined pointer Data is
passed unchanged to the callback function. If this pointer is not required set it to NULL.
Enumeration stops immediately if the return value of the callback function is nonzero. This function
depends not on an open PDF file.
Remarks:
The function does not display error messages or warnings. The internal exception handling of
DynaPDF is not used by this function.
Return values:
If the function succeeds the return value is the number of available font files or zero if no font files
were found. If the function fails the return value is a negative error code. At time of publication
negative error codes are not returned.
Example (Delphi):
// In this example we have a combo box on the form that should be
// filled with the available fonts when the form is created.
// The font names passed to the callback function are already sorted in
 

Previous topic: EnumDocFonts

Next topic: EnumHostFontsEx