Difference between revisions of "GreQueryFonts"

From EDM2
Jump to: navigation, search
(Created page with "GreQueryFonts returns the details of fonts that match the face name addressed by pszFaceName. This function is supported by the graphics engine. == Syntax == GreQueryFon...")
 
(No difference)

Latest revision as of 03:45, 16 January 2020

GreQueryFonts returns the details of fonts that match the face name addressed by pszFaceName.

This function is supported by the graphics engine.

Syntax

GreQueryFonts(hdc, flOptions, pszFaceName, paMetrics, cMetricLen, pcFontCount, pInstance, lFunction);

Parameters

hdc (HDC) - input
Device context handle.
flOptions (ULONG) - input
Flags indicating whether private fonts, public fonts, or both are required.
These flags can be used in combination:
  • QFF_PUBLIC Enumerate public fonts
  • QFF_PRIVATE Enumerate private fonts
pszFaceName (PSZ) - input
Pointer to a string specifying the face name.
When this is NULL, all faces are matched.
paMetrics (PFONTMETRICS) - input
Pointer to an array of font element records to which the metrics of matching fonts are returned. This is a pointer to an array of up to cFontCount font metric records, each of which contains a maximum of cMetricLen bytes. Note that for multi-codepage fonts the usCodePage field has no meaning and is set to 0.
cMetricLen (ULONG) - input
Length in bytes of each metrics structure in the paMetrics array.
pcFontCount (PULONG) - input
Pointer to cFontCount that specifies the number of fonts for which metrics are required. On return, this is updated to the number of fonts for which metrics were returned.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreQueryFonts.

Returns

rc (LONG) - returns
Return codes.
This function returns the number of fonts not returned, or it returns GPI_ALTERROR if an error occurs.
Possible Errors Detected
When an error is detected, the graphics engine calls WinSetErrorInfo to post the condition. Reasons for failure of this function include:
  • PMERR_COORDINATE_OVERFLOW
  • PMERR_DEV_FUNC_NOT_INSTALLED
  • PMERR_HDC_BUSY
  • PMERR_INV_COORD_SPACE
  • PMERR_INV_HDC
  • PMERR_INV_LENGTH_OR_COUNT
  • PMERR_INV_OR_INCOMPAT_OPTIONS
Refer to the "Error Explanations" section of the Presentation Manager Programming Reference for further explanation.

Sample

#define INCL_GRE_FONTS
#include <os2.h>

HDC             hdc;          /*  Device context handle. */
ULONG           flOptions;    /*  Flags indicating whether private fonts, public fonts, or both are required. */
PSZ             pszFaceName;  /*  Pointer to a string specifying the face name. */
PFONTMETRICS    paMetrics;
ULONG           cMetricLen;   /*  Length in bytes of each metrics structure in the paMetrics array. */
PULONG          pcFontCount;
PVOID           pInstance;    /*  Pointer to instance data. */
ULONG           lFunction;    /*  High-order WORD=flags; low-order WORD=NGreQueryFonts. */
LONG            rc;           /*  Return codes. */

rc = GreQueryFonts(hdc, flOptions, pszFaceName,
       paMetrics, cMetricLen, pcFontCount,
       pInstance, lFunction);