gpi12.hlp (Table of Contents; Topic list)
GpiLoadFonts (1.2)
Function Group  Overview  Changes               Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_GPILCIDS
 
BOOL GpiLoadFonts(hab, pszFileName)
HAB hab;            /* anchor-block handle */
PSZ pszFileName;    /* pointer to filename */
 
The GpiLoadFonts function loads fonts from the specified resource file. Once
loaded, the fonts are private fonts and can be used by any thread in the
process. Any other process can use the fonts but only if it also loads the
font by using the GpiLoadFonts. The function loads a copy of the fonts once
only. Any subsequent call to the function by another process for the same
fonts simply increments the use count for the resource and gives that
process access.
 
Parameter    Description
────────────────────────────────────────────────────────────────────────────
 
hab          Identifies the anchor block.
 
pszFileName  Points to a null-terminated string. This string must be a valid
             MS OS/2 filename. If it does not specify a path and the
             filename extension, the function appends the default extension
             (.dll) and searches for the font resource file in the
             directories specified by the libpath command in the config.sys
             file.
 
Return Value
 
The return value is GPI_OK if the function is successful or GPI_ERROR if an
error occurred.
 
Errors
 
Use the WinGetLastError function to retrieve the error value, which may be
the following:
 
     PMERR_INV_FONT_FILE_DATA
 
Example
 
This example uses the GpiLoadFonts function to load all fonts from the font
resource file helv.dll. The GpiQueryFonts function retrieves the number of
fonts loaded.
 
LONG cFonts = 0L;
 
GpiLoadFonts(hab, "helv");
cFonts = GpiQueryFonts(hps, QF_PRIVATE, (PSZ) NULL, &cFonts, 0L,
    (PFONTMETRICS) NULL);
 
See Also
 
GpiCreateLogFont, GpiDeleteSetId, GpiQueryFonts, GpiUnloadFonts,
WinGetLastError