Difference between revisions of "GreQueryFontFileDescriptions"

From EDM2
Jump to: navigation, search
(Created page with "GreQueryFontFileDescriptions determines whether a file is a font file and, if so, returns the family and face names for the fonts in the file. This function is supported by ...")
 
(No difference)

Latest revision as of 03:50, 16 January 2020

GreQueryFontFileDescriptions determines whether a file is a font file and, if so, returns the family and face names for the fonts in the file.

This function is supported by the graphics engine.

Syntax

GreQueryFontFileDescriptions(hdc, pszFileName, pcFonts, paszNames, pInstance, lFunction);

Parameters

hdc (HDC) - input
Device context handle.
pszFileName (PSZ) - input
Pointer to the file path and name of the font file.
pcFonts (PULONG) - input
Pointer.
Pointer to a count of the maximum number of family and face name pairs to be returned. On completion, this count is updated to the number of pairs actually returned.
paszNames (PSZ) - input
Pointer.
Pointer to an array of family and face name pairs whose size is 2 x pcFonts. The family name is the first in each pair.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreQueryFontFileDescriptions.

Returns

rc (ULONG) - 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_BASE_ERROR
  • PMERR_INV_FONT_FILE_DATA
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. */
PSZ       pszFileName;  /*  Pointer to the file path and name of the font file. */
PULONG    pcFonts;      /*  Pointer. */
PSZ       paszNames;    /*  Pointer. */
PVOID     pInstance;    /*  Pointer to instance data. */
ULONG     lFunction;    /*  High-order WORD=flags; low-order WORD=NGreQueryFontFileDescriptions. 

 */
ULONG     rc;           /*  Return codes. */

rc = GreQueryFontFileDescriptions(hdc, pszFileName,
       pcFonts, paszNames, pInstance, lFunction);

Remarks

The names are returned at the location addressed by paszNames. Typically, the calling routine calls GreQueryFontFileDescriptions twice. The first call sets pcFonts to 0 and determines the number of fonts in the file. When sufficient storage is allocated for the names, GreQueryFontFileDescriptions is called again with pcFonts pointing to the font count.