GreQueryCharPositions

GreQueryCharPositions stores, at the location addressed by paptXY, an array of world coordinates identifying the start points at which the device is to place each character of a given string.

This function must be supported by the presentation driver. GreQueryCharPositions is called by GpiQueryCharStringPos, and is used to get the position where the next string output would occur relative to the current presentation space position. It also returns the starting position of each character within that string.


 * Simulation support: None. This function is mandatory for all drivers.

Syntax
GreQueryCharPositions(hdc, pptlStart, flOptions, cChars, pchString, pAdx,      paptXY, pInstance, lFunction);

Parameters

 * hdc (HDC) - input
 * Device context handle.


 * pptlStart (PPOINTL) - input
 * Pointer to (X,Y) coordinates of optional starting position.


 * flOptions (ULONG) - input
 * Options flags.


 * The following flags can be set:


 * CHS_VECTOR
 * If set, increment vector is present.
 * CHS_START_XY
 * If set, starting position is present. Otherwise, pptlStart is ignored.


 * cChars (LONG) - input
 * Number of bytes in string.


 * pchString (PCH) - input
 * Pointer to character string.


 * pAdx (PLONG) - input
 * Pointer to Increment array.


 * Vector of increment values with one element for each character in the string. After writing a character, the increment specifies the absolute distance in world coordinates to get to the starting point of the next character.


 * paptXY (PPOINTL) - input
 * Pointer to array where character positions are returned.


 * Pointer to an array of (cChars+1) returned positions. The first value in the array is the initial current position; the last value is the current position on return.


 * pInstance (PVOID) - input
 * Pointer to instance data.


 * lFunction (ULONG) - input
 * High-order WORD=flags; low-order WORD=NGreQueryCharPositions.

Return Code

 * rc (BOOL) - returns
 * Return Code.


 * On completion, the handling routine must return a BOOLEAN value to indicate success or an error.


 * TRUE Successful
 * FALSE Error


 * Possible Errors Detected: When an error is detected, the handling routine must call WinSetErrorInfo to post the condition. Error codes for conditions that the handling routine is expected to check include:


 * PMERR_COORDINATE_OVERFLOW
 * PMERR_DEV_FUNC_NOT_INSTALLED
 * PMERR_EXCEEDS_MAX_SEG_LENGTH
 * PMERR_HDC_BUSY
 * PMERR_INSUFFICIENT_MEMORY
 * PMERR_INV_CHAR_ANGLE_ATTR
 * PMERR_INV_CHAR_MODE_ATTR
 * PMERR_INV_CHAR_POS_OPTIONS
 * PMERR_INV_CODEPAGE
 * PMERR_INV_COORD_SPACE
 * PMERR_INV_HDC
 * PMERR_INV_LENGTH_OR_COUNT
 * PMERR_INV_MATRIX_ELEMENT
 * PMERR_INV_SETID
 * PMERR_INV_TRANSFORM_TYPE

Refer to the "Error Explanations" section in the Presentation Manager Programming Reference for further explanation.

Remarks
GreQueryCharPositions is required for the management of device fonts in CM_MODE2 only. When the presentation driver has no device fonts, the handling routine must post PMERR_DEV_FUNC_NOT_INSTALLED.

Sample Code

 * 1) define INCL_GRE_STRINGS
 * 2) include 

HDC       hdc;        /*  Device context handle. */ PPOINTL   pptlStart;  /*  Pointer to (X,Y) coordinates of optional starting position. */ ULONG     flOptions;  /*  Options flags. */ LONG      cChars;     /*  Number of bytes in string. */ PCH       pchString;  /*  Pointer to character string. */ PLONG     pAdx;       /*  Pointer to Increment array. */ PPOINTL   paptXY;     /*  Pointer to array where character positions are returned. */ PVOID     pInstance;  /*  Pointer to instance data. */ ULONG     lFunction;  /*  High-order WORD=flags; low-order WORD=NGreQueryCharPositions. */ BOOL      rc;         /*  Return Code. */

rc = GreQueryCharPositions(hdc, pptlStart,      flOptions, cChars, pchString, pAdx,       paptXY, pInstance, lFunction); 