DynaPDF Manual - Page 183

Previous Page 182   Index   Next Page 184

Function Reference
Page 183 of 839
BuildFamilyNameAndStyle
Syntax:
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
false.
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;
else
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;
else
selMode = smFamilyName;
pdfSetFontSelMode(pdf, selMode);
return pdfSetFont(pdf, fontName, style, 12.0, true, cp1252);
}else
return retval;
}
 

Previous topic: Bezier_1_3, Bezier_2_3

Next topic: CalcPagePixelSize (Rendering Engine), CalcWidthHeight