DynaPDF Manual - Page 344

Previous Page 343   Index   Next Page 345

Function Reference
Page 344 of 839
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.
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.

Previous topic: EnumDocFonts

Next topic: EnumHostFontsEx