Jump to content

GpiLoadFonts

From EDM2
Revision as of 21:29, 6 April 2025 by Iturbide (talk | contribs) (Created page with "This function loads one or more fonts from the specified resource file. ==Syntax== GpiLoadFonts(hab, pszFilename) ==Parameters== ; hab (HAB) - input : Anchor-block handle. ; pszFilename (PSZ) - input : Filename. : This is the fully-qualified name of the font resource. ==Return Value== ; rc (BOOL) - returns : Success indicator. :; TRUE :: Successful completion :; FALSE :: Error occurred. ==Remarks== All of the fonts in the file become available for any p...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function loads one or more fonts from the specified resource file.

Syntax

GpiLoadFonts(hab, pszFilename)

Parameters

hab (HAB) - input
Anchor-block handle.
pszFilename (PSZ) - input
Filename.
This is the fully-qualified name of the font resource.

Return Value

rc (BOOL) - returns
Success indicator.
TRUE
Successful completion
FALSE
Error occurred.

Remarks

All of the fonts in the file become available for any presentation space (GPI or VIO) created by the same process. They are not available for any other process. The format of the font definitions in the resource file is defined in Font-File Format. When no longer required, the fonts may be unloaded with GpiUnloadFonts. Note: Fonts loaded with GpiLoadFonts are not available for use for spooled printing, that is if a device type of OD_QUEUED is specified in DevOpenDC; in this case GpiCreateLogFont will never return FONT_MATCH for these fonts. To avoid this, install the fonts as public fonts using the Font Palette object located in the System Setup folder, on both the generating and the receiving workstations if these are different.

Errors

Possible returns from WinGetLastError:

PMERR_INV_FONT_FILE_DATA (0x2073)
The font file specified with GpiLoadFonts, GpiLoadPublicFonts, GpiQueryFontFileDescriptions, or GpiQueryFullFontFileDescs contains invalid data.

Example Code

#define INCL_GPILCIDS /* Or use INCL_GPI, INCL_PM, */
#include <os2.h>

HAB     hab;         /* Anchor-block handle. */
PSZ     pszFilename; /* Filename. */
BOOL    rc;          /* Success indicator. */

rc = GpiLoadFonts(hab, pszFilename);

This example uses the GpiLoadFonts function to load all fonts from the font resource file HELV.FON. The GpiQueryFonts function retrieves the number of fonts loaded.

#define INCL_GPILCIDS /* Font functions */
#include <os2.h>

HPS hps; /* presentation space handle */
HAB hab; /* anchor-block handle */
LONG cFonts = 0L; /* font count */
LONG remFonts; /* fonts not returned */

GpiLoadFonts(hab, "C:\\HELV.FON");

remFonts = GpiQueryFonts(hps, QF_PRIVATE, NULL, &cFonts, 0L, NULL);

Related Functions