gpi12.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
GpiQueryFonts (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_GPILCIDS
 
LONG GpiQueryFonts(hps, flOptions, pszFacename, pcFonts, cbMetrics,
    pfm)
HPS hps;             /* presentation-space handle                */
ULONG flOptions;     /* type of fonts to retrieve                */
PSZ pszFacename;     /* address of typeface name of the fonts    */
PLONG pcFonts;       /* number of fonts to retrieve              */
LONG cbMetrics;      /* length of the structure                  */
PFONTMETRICS pfm;    /* address of structure(s) for font metrics */
 
The GpiQueryFonts function retrieves the font metrics for loaded fonts. The
function copies the font metrics for the fonts that have the typeface name
specified by the pszFacename parameter to the structure or array of
structures pointed to by the pfm parameter. The function retrieves font
metrics for all fonts up to the number specified by the pcFonts parameters.
If the function does not retrieve font metrics for all the fonts, it returns
the number of remaining fonts.
 
All sizes retrieved by the function are in world coordinates.
 
Parameter    Description
────────────────────────────────────────────────────────────────────────────
 
hps          Identifies the presentation space.
 
flOptions    Specifies the type of fonts to retrieve. It can be a
             combination of the following values:
 
             Value       Meaning
             ───────────────────────────────────────────────────────────────
             QF_PUBLIC   Retrieve public fonts. Public fonts were loaded by
                         the system and are available to all applications.
 
             QF_PRIVATE  Retrieve private fonts. Private fonts were loaded
                         by the application and are available only to it.
 
pszFacename  Points to the typeface name of the fonts. If the pszFacename
             parameter is a NULL pointer, the function retrieves metrics for
             all available fonts regardless of their typeface names.
 
pcFonts      Points to a variable containing the number of fonts for which
             to retrieve metrics. The function copies to this variable the
             actual number of fonts it retrieved.
 
cbMetrics    Specifies the length of one FONTMETRICS structure.
 
pfm          Points to one or more FONTMETRICS structures that receive the
             metrics of the fonts. The number of structure required is
             specified by the pcFonts parameter.
 
Return Value
 
The return value is the number of fonts not returned if the function is
successful or GPI_ALTERROR if an error occurred.
 
Errors
 
Use the WinGetLastError function to retrieve the error value, which may be
one of the following:
 
     PMERR_INV_HPS
     PMERR_INV_LENGTH_OR_COUNT
     PMERR_PS_BUSY
 
Example
 
This example uses the GpiQueryFonts function to retrieve the font metrics
for all private fonts having the "Helv" typeface name. The function is
called twice, once to determine the number of fonts available, again to
retrieve the font metrics for all the fonts.
 
LONG cFonts, lTemp = 0L;
SEL sel;
PFONTMETRICS pfm;
 
/* Determine the number of fonts. */
 
cFonts = GpiQueryFonts(hps, QF_PRIVATE, "Helv", &lTemp,
    (LONG) sizeof(FONTMETRICS), (PFONTMETRICS) NULL);
 
/* Allocate space for the font metrics. */
 
DosAllocSeg((USHORT) (sizeof(FONTMETRICS) * cFonts),
    &sel, SEG_NONSHARED);
pfm = MAKEP(sel, 0);
 
/* Retrieve the font metrics. */
 
cFonts = GpiQueryFonts(hps, QF_PRIVATE, "Helv", &cFonts,
    (LONG) sizeof(FONTMETRICS), pfm);
 
See Also
 
GpiCreateLogFont, GpiQueryFontMetrics, FATTRS, FONTMETRICS