DynaPDF Manual - Page 420

Previous Page 419   Index   Next Page 421

Function Reference
Page 420 of 839
GetFontMetrics
Syntax:
LBOOL pdfGetFontMetrics(
const PPDF* IPDF,
// Instance pointer
UI32 Handle,
// Font handle
struct TPDFFontMetrics* Metrics) // see below
struct TPDFFontMetrics
{
UI32
StructSize;
// Must be set to sizeof(TPDFFontMetrics)
float
Ascent;
// Ascent (usWinAscent)
float
AvgWidth;
// Average character width
float
CapHeight;
// Cap height
float
DefWidth;
// Default width
float
Descent;
// Descent
UI32
FirstChar;
// First char
float
FixedWidth;
// Width of all glyphs in a fixed pitch font
TFStyle
FontStyle;
// Font style with which the font was loaded
struct TBBox FontBBox;
// Font's bounding box
LBOOL
IsFixedPitch;
// Is this a fixed pitch font?
LBOOL
IsSymbolFont;
// Is this is a symbolic font?
LBOOL
IsStdFont;
// Is this is a standard font?
float
ItalicAngle;
// Italic angle of italic fonts
UI32
LastChar;
// Last char
float
LineGap;
// sTypoLineGap of the OS/2 table of TrueType and OpenType fonts
UI32
MacStyle;
// macOS style flags
TFStyle
RealStyle;
// This is the real style of the font
float
StemV;
// Width of vertical stems
float
StrikeoutPos;
// Strikeout position
float
StrikeoutWidth; // Width of the strikeout line
float
UnderlinePos;
// Underline position
float
UnderlineWidth; // Width of the underline
UI32
UnicodeRange1;
// Bitset -> TUnicodeRange1
UI32
UnicodeRange2;
// Bitset -> TUnicodeRange2
UI32
UnicodeRange3;
// Bitset -> TUnicodeRange3
UI32
UnicodeRange4;
// Bitset -> TUnicodeRange4
UI32
Weight;
// Font weight
UI32
WidthClass;
// Width class of the font
float
WinDescent;
// usWinDescent of the OS/2 table of TrueType and OpenType fonts
UI32
WinStyle;
// fsSelection of the OS/2 table of TrueType and OpenType fonts
float
XHeight;
// X-height
float
TypoAscender;
// sTypoAscender of the OS/2 table of TrueType and OpenType fonts
float
TypoLeading;
// Typographic leading or line height of the font. This is
// TypoAscender - Descent + LineGap. If typographic metrics are
// not available then TypoAscender is set to Ascent.
};
The function retrieves the most important metrics of a font. The parameter Handle must be a valid
font handle that was returned by SetFont(), SetFontEx(), or SetCIDFont().
The member StructSize must be initialized to sizeof(TPDFFontMetrics) before the function can be
called. The values are scaled to a normalized font size of 1000 units. In order to scale the values to an
arbitrary font size multiply the values with (fontSize / 1000.0).
Example:
m.Ascent *= 12.0f / 1000.0f;
Return values:
If the function succeeds the return value is 1. If the function fails the return value is 0.
 

Previous topic: GetFontInfoEx, GetFontOrigin

Next topic: GetFontSearchOrder, GetFontSelMode, GetFontSize, GetFontWeight