Jump to content

GpiQueryWidthTable

From EDM2

This function returns width table information for the logical font identified by the value of the character-set attribute.

Syntax

GpiQueryWidthTable(hps, lFirstChar, lCount, alData)

Parameters

hps (HPS) - input
Presentation-space handle.
lFirstChar (LONG) - input
Codepoint of first character.
The codepoint of the initial character, for which width-table information is required.
lCount (LONG) - input
Count of elements in alData.
The number that should be allowed for, so as to retrieve the full width table. Data for this font can be found by GpiQueryFontMetrics.
alData (PLONG) - output
Array of width values.
An array of lCount elements, in which width-table information is returned. No more than lCount elements are returned.

Return Value

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

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_FIRST_CHAR (0x2071)
An invalid firstchar parameter was specified with GpiQueryWidthTable.
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    lFirstChar; /* Codepoint of first character. */
LONG    lCount;     /* Count of elements in alData. */
PLONG   alData;     /* Array of width values. */
BOOL    rc;         /* Success indicator. */

rc = GpiQueryWidthTable(hps, lFirstChar, lCount, alData);

In this example the widths of the first 50 characters of the current font are obtained.

#define INCL_GPILCIDS
#include <OS2.H>

#define COUNT 50

HPS hps; /* Presentation-space */
         /* handle. */
LONG alData[COUNT]; /* array of width values. */

GpiQueryWidthTable(hps, 0, COUNT, alData);