GpiQueryLogicalFont
Appearance
This function returns the description of a logical font. See GpiCreateLogFont.
Syntax
GpiQueryLogicalFont(ps, lcid, name, attrs, length)
Parameters
- ps (HPS) - input
- Presentation-space handle.
- lcid (LONG) - input
- Local identifier.
- Logical font local identifier, in the range 0 through 254. Specify 0 to query the default font.
- name (PSTR8) - output
- Logical font name.
- An 8-character name for the logical font.
- attrs (PFATTRS) - output
- Attributes of font.
- length (LONG) - input
- Length of attrs buffer.
- The maximum length of font attribute data to be returned.
Return Value
- rc (BOOL) - returns
- Success indicator.
- TRUE
- Successful completion
- FALSE
- Error occurred.
Remarks
If the specified local identifier is in use to tag a bit map (see GpiSetBitmapId), an error is raised.
Errors
Possible returns from WinGetLastError:
- PMERR_INV_HPS (0x207F)
- An invalid presentation-space handle was specified.
- PMERR_PS_BUSY (0x20F4)
- An attempt was made to access the presentation space from more than one thread simultaneously.
- PMERR_INV_SETID (0x20CA)
- An invalid setid parameter was specified.
- PMERR_SETID_IN_USE (0x2102)
- An attempt was made to specify a setid that was already in use as the currently selected character, marker or pattern set.
- PMERR_INV_LENGTH_OR_COUNT (0x2092)
- An invalid length or count parameter was specified.
Example Code
#define INCL_GPILCIDS /* Or use INCL_GPI, INCL_PM, */ #include <os2.h> HPS ps; /* Presentation-space handle. */ LONG lcid; /* Local identifier. */ PSTR8 name; /* Logical font name. */ PFATTRS attrs; /* Attributes of font. */ LONG length; /* Length of buffer. */ BOOL rc; /* Success indicator. */ rc = GpiQueryLogicalFont(ps, lcid, name, attrs, length);
This example uses GpiQueryLogicalFont to return the description of the default logical font and if the query succeeds, assigns the font code page to a variable.
#define INCL_GPILCIDS /* Font functions */ #include <os2.h> BOOL fSuccess; /* success indicator */ HPS hps; /* Presentation-space handle */ LONG lLcid; /* local identifier */ STR8 Name; /* 8 character logical font name */ FATTRS fatAttrs; /* Attributes of font */ LONG lAttrsLength; /* length of buffer */ USHORT usFontCodePage; /* font code page */ /* query the default font */ lLcid = 0L; /* return all information */ lAttrsLength = sizeof(FATTRS); fSuccess = GpiQueryLogicalFont(hps, lLcid, &Name, &fatAttrs, lAttrsLength); /* if successful, assign value of font code page */ if (fSuccess == TRUE) usFontCodePage = fatAttrs.usCodePage;