Xojo Conferences

DynaPDF Manual - Page 456

Previous Page 455   Index   Next Page 457

Function Reference
Page 456 of 766
// Bitmask
The function returns the most important properties of a system font. The member StructSize must be
set to sizeof(TPDFSysFont) before the function can be called.
If you want know how many fonts will be returned then call EnumHostFonts() with the parameter
EnumProc set to NULL beforehand. The function returns the number of available fonts in this case.
However, also if the number of host fonts is known, it is not possible to loop over the available fonts
from 0 to FontCount - 1 since the parameter Handle represents no array index.
In the first call set the parameter Handle to 0 or Out to NULL. In this case, the function returns the
handle of the first font file. This value must be passed to the next call until the return value is zero.
Note that if Out is set in the first call, then the first font will already be returned.
Since the return value could be zero if only one system font is available, the caller must check
whether FamilyName is non-NULL to determine whether a font was returned (all members are
initialized with zero in this case). The family name is always set if a font was returned.
Example (C#):
// This code adds the full names to a list box.
int next;
TPDFSysFont f = new TPDFSysFont();
next = 0;
next = pdf.GetSysFontInfo(next, ref f);
if (next >= 0 && f.FamilyName != null)
while (next > 0)
next = pdf.GetSysFontInfo(next, ref f);
if (next >= 0)
The function returns the fonts in the current font search order. That means if the search order is
{fbtTrueType, fbtOpenType, fbtType1, fbtStdFont}, for example, then the function returns first all
TrueType fonts sorted in ascending order, then all OpenType fonts, and so on.
Since standard fonts are no system fonts, these fonts are not returned.
Return values:
If the function succeeds the return value is greater or equal zero and the parameter Out was
initialized or filled with values. If the function fails the return value is a negative error code. The
parameter Out is not initialized in this case.

Previous topic: GetSysFontInfo

Next topic: GetTemplHeight