Jump to content

GpiQueryFontMetrics

From EDM2
Revision as of 21:30, 6 April 2025 by Iturbide (talk | contribs) (Created page with "This function returns a record providing details of the font metrics for the logical font that is currently selected. ==Syntax== GpiQueryFontMetrics(hps, lMetricsLength, pfmMetrics) ==Parameters== ; hps (HPS) - input : Presentation-space handle. ; lMetricsLength (LONG) - input : Length of metrics. : It must be greater or equal to 0. ; pfmMetrics (PFONTMETRICS) - output : Metrics of font. : In this buffer are returned the font metrics of the logical font,...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function returns a record providing details of the font metrics for the logical font that is currently selected.

Syntax

GpiQueryFontMetrics(hps, lMetricsLength, pfmMetrics)

Parameters

hps (HPS) - input
Presentation-space handle.
lMetricsLength (LONG) - input
Length of metrics.
It must be greater or equal to 0.
pfmMetrics (PFONTMETRICS) - output
Metrics of font.
In this buffer are returned the font metrics of the logical font, identified by the current value of the character set attribute.
No more data than lMetricsLength is returned.

Return Value

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

Remarks

All sizes are returned in world coordinates. An application can determine if the font szFacename (as returned in pfmMetrics) has been truncated by checking the fsType field in pfmMetrics for the FM_TYPE_FACETRUNC indicator. If the face name has been truncated, this bit will be set, and the application can issue a WinQueryAtomName function, passing in the FaceNameAtom (as returned in pfmMetrics) to retrieve the full face name from the System Atom table.

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_LENGTH_OR_COUNT (0x2092)
An invalid length or count parameter was specified.
PMERR_COORDINATE_OVERFLOW (0x2014)
An internal coordinate overflow error occurred. This can occur if coordinates or matrix transformation elements (or both) are invalid or too large.

Example Code

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

HPS            hps;            /* Presentation-space handle. */
LONG           lMetricsLength; /* Length of metrics. */
PFONTMETRICS   pfmMetrics;     /* Metrics of font. */
BOOL           rc;             /* Success indicator. */

rc = GpiQueryFontMetrics(hps, lMetricsLength, pfmMetrics);

This example uses the GpiQueryFontMetrics function to retrieve the font metrics for the current font.

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

HPS hps; /* presentation space handle */
FONTMETRICS fm; /* metrics structure */

GpiQueryFontMetrics(hps, sizeof(FONTMETRICS), &fm);