Jump to content

GreDeviceSetAVIOFont

From EDM2
Revision as of 23:03, 17 January 2020 by Martini (talk | contribs) (Created page with "GreDeviceSetAVIOFont loads or deletes an image font used by the AVIO presentation space associated with the device context. ;Simulation support: This function is mandatory f...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

GreDeviceSetAVIOFont loads or deletes an image font used by the AVIO presentation space associated with the device context.

Simulation support
This function is mandatory for display drivers. For other drivers, it is simulated by a handling routine in the graphics engine.

Syntax

GreDeviceSetAVIOFont(hdc, pLogFont, pFontDef, lcid, pInstance, lFunction);

Parameters

hdc (HDC) - input
The device context handle.
pLogFont (PFATTRS) - input
A pointer to a logical font.
pFontDef (PBYTE) - input
A pointer to a physical font data structure. When the value passed is 0, the handling routine must delete the loaded font corresponding to lLcid. If the high-order bit of the high-order WORD in lLcid is set, the handle is for a device font.
lcid (LONG) - input
Local identifier value of -2, -3, or -4.
pInstance (PVOID) - input
A pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreDeviceSetAVIOFont.

Returns

fSuccess (BOOL) - returns
Return codes.
On completion, the handling routine must return BOOLEAN (fSuccess).
  • TRUE Successful. The font is acceptable for use with an AVIO presentation space.
  • FALSE Error.

Sample

#define INCL_GRE_DEVMISC1
#include <os2.h>

HDC        hdc;        /*  The device context handle. */
PFATTRS    pLogFont;   /*  A pointer to a logical font. */
PBYTE      pFontDef;
LONG       lcid;       /*  Local identifier value of -2, -3, or -4. */
PVOID      pInstance;  /*  A pointer to instance data. */
ULONG      lFunction;  /*  High-order WORD=flags; low-order WORD=NGreDeviceSetAVIOFont. */
BOOL       fSuccess;   /*  Return codes. */

fSuccess = GreDeviceSetAVIOFont(hdc, pLogFont,
             pFontDef, lcid, pInstance, lFunction);

Remarks

When loaded, the font is used by subsequent GreCharRect, GreCharStr, and GreScrollRect calls to draw the character images for the appropriate AVIO set. lLcid identifiers LCID_AVIO_1, LCID_AVIO_2, and LCID_AVIO_3 correspond to AVIO sets 1, 2, and 3 respectively.

If the font is not acceptable for use with an AVIO presentation space, the handling routine returns FALSE to indicate an error. The font must be a fixed-pitch image (raster) font that matches one of the cell sizes for the default font. If the font does not match a supported cell size, the characters are displayed in the presentation space as black cells.

A possible approach is for the presentation driver to realize the AVIO fonts required and store the pointers to the fonts in the DC instance data structure.