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

DynaPDF Manual - Page 158

Previous Page 157   Index   Next Page 159

Function Reference
Page 158 of 750
LBOOL fntBuildFamilyNameAndStyle(
const void* IFont,
// Pointer to font object
char Name[128],
// 128 bytes long font name buffer
TFStyle ADDR Style) // Font style
The function tries to extract the famaily name and font style from a font object. If the family name is
not available or could not be algorithmically identified, the postscript name is copied to the
parameter Name instead. The return value indicates whether the copied font name is probably a
family name or a postscript name. The font selection mode should be set according to the return
value when trying to load the font from the system (see SetFontSelMode()).
Return values:
If the family name could be extracted the return value is 1. If the font does not contain a family name
or if there is no safe indication whether the font name represents a family name the return value is
Example (C++):
SI32 SetPDFFont(const void* IFont)
SI32 retval;
TFStyle style;
TFontSelMode selMode;
char fontName[128];
// Get the font name
if (fntBuildFamilyNameAndStyle(IFont, fontName, fontStyle))
selMode = smFamilyName;
selMode = smPostScriptName;
// Set font selection mode for the first search run
pdfSetFontSelMode(pdf, selMode);
if ((retval = pdfSetFont(pdf, fontName, style, 12, true, cp1252)) < 0)
// If the font cannot be found then search again with reversed font
// selection mode.
if (selMode == smFamilyName)
selMode = smPostScriptName;
selMode = smFamilyName;
pdfSetFontSelMode(pdf, selMode);
return pdfSetFont(pdf, fontName, style, 12.0, true, cp1252);
return retval;

Previous topic: Bezier_2_3

Next topic: CalcWidthHeight