Jump to content

GpiUnloadPublicFonts

From EDM2

This function unloads one or more generally-available fonts from the specified resource file. See GpiLoadPublicFonts.

Syntax

GpiUnloadPublicFonts(hab, pszFilename)

Parameters

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

Return Value

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

Remarks

Before issuing this function, the application must:

  1. Issue GpiSetCharSet to a font other than one of those to be unloaded, for example, to the default font.
  2. Issue GpiDeleteSetId for each local identifier (lcid) that references one of the fonts (the LCID_ALL option can be used if all lcids are to be deleted).

An error is returned if lcids that reference one of the fonts still exist for this or any other application, and the unload fails.

Note: If another application is using the fonts when this function is issued, so that the call fails, the fonts are likely to remain loaded until the next boot. This is true even if the other application has issued a GpiLoadPublicFonts, and will later issue a GpiUnloadPublicFonts, since the use count is not decremented when the call fails.

It is also possible for one application to get details of the fonts with GpiQueryFonts, but then to fail to be able to use them with GpiCreateLogFont, because another application unloaded them with GpiUnloadPublicFonts in the time between the two calls.

Errors

Possible returns from WinGetLastError:

PMERR_FONT_FILE_NOT_LOADED (0x202E)
An attempt was made to unload a font file that was not loaded.
PMERR_OWN_SET_ID_REFS (0x20EB)
An attempt to unload a font failed because the setid is still being referenced.

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 = GpiUnloadPublicFonts(hab, pszFilename);

This function unloads one or more generally-available fonts from the specified resource file.

#define INCL_GPILCIDS
#include <OS2.H>

HAB hab; /* Anchor-block handle. */
char fntname[] = "HELVETICA.FON";

GpiUnloadPublicFonts(hab,fntname);