GCP_RESULTS
The GCP_RESULTS
structure contains information about characters in a string. This structure
receives the results of the GetCharacterPlacement
typedef struct tagGCP_RESULTS {
DWORD
lStructSize;
LPTSTR lpOutString;
UINT
*lpOrder;
INT
*lpDx;
INT
*lpCaretPos;
LPTSTR lpClass;
UINT
*lpGlyphs;
UINT
nGlyphs;
UINT
nMaxFit;
} GCP_RESULTS;
Members
lStructSize
Specifies the
size, in bytes, of the structure.
lpOutString
Pointer to
the buffer that receives the output string or is NULL if the output string is
not needed. The output string is a version of the original string that is in
the order that will be displayed on a given device. Typically the output string
is identical to the original string, but may be different if the string needs
reordering and the GCP_REORDER flag is set or if the the original string
exceeds the maximum extent and the GCP_MAXEXTENT flag is set.
lpOrder
Address of
the array that receives the ordering indices for the characters in the output
string or is NULL if the ordering indices are not needed. The original string
needs reordering if the GetFontLanguageInfo
lpDx
Pointer to
the array that receives the distances between adjacent character cells or is
NULL if these distances are not needed. If glyph rendering is done, the
distances are for the glyphs not the characters, so the resulting array can be
used with the ExtTextOut
The distances
in this array are in display order. To find the distance for the ith
character in the original string, use the lpOrder array as follows:
width = lpDx[lpOrder[i]];
On input,
this member may contain justification weight values if the GCP_JUSTIFYIN value
is given with the GetCharacterPlacement
lpCaretPos
Pointer to
the array that receives the caret position values or is NULL if caret positions
are not needed. Each value specifies the caret position immediately before the
corresponding character. In some languages the position of the caret for each
character may not be immediately to the left of the character. For example, in
Hebrew, in which the text runs from right to left, the caret position is to the
right of the character. If glyph ordering is done, lpCaretPos matches
the original string not the output string. This means that some adjacent
values may be the same.
The values in
this array are in input order. To find the caret position value for the ith
character in the original string, use the array as follows:
position = lpCaretPos[i];
lpClass
Pointer to
the array that contains and/or receives character classifications. The values
indicate how to lay out characters in the string and are similar (but not
identical) to the CT_CTYPE2 values returned by the GetStringTypeEx
function. Each element of the array can be set to zero or one of the following
values:
Value |
Meaning |
GCPCLASS_ARABIC |
Arabic
character. |
GCPCLASS_HEBREW |
Hebrew
character. |
GCPCLASS_LATIN |
Character
from a Latin or other single-byte character set for a left-to-right language. |
GCPCLASS_LATINNUMBER |
Digit from
a Latin or other single-byte character set for a left-to-right language. |
GCPCLASS_LOCALNUMBER |
Digit from
the character set associated with the current font. |
In addition,
the following can be used when supplying values in the lpClass array
with the GCP_CLASSIN flag.
Value |
Meaning |
GCPCLASS_LATINNUMERICSEPARATOR |
Input only.
Character used to separate Latin digits, such as acomma or decimal point. |
GCPCLASS_LATINNUMERICTERMINATOR |
Input only.
Character used to terminate Latin digits, such as a plus or minus sign. |
GCPCLASS_NEUTRAL |
Input only.
character has no specific classification. |
GCPCLASS_NUMERICSEPARATOR |
Input only.
Character used to separate digits, such as a comma or decimal point. |
For languages
that use the GCP_REORDER flag, the following values can also be used with the
GCP_CLASSIN flag. Unlike the preceding values, which can be used anywhere in
the lpClass array, all of the following values are used only in the
first location in the array. All combine with other classifications. Note that
GCPCLASS_PREBOUNDLTR and GCPCLASS_PREBOUNDRTL are mutually exclusive, as are
GCPCLASSPOSTBOUNDLTR and GCPCLASSPOSTBOUNDRTL.
Value |
Meaning |
GCPCLASS_PREBOUNDLTR |
Set lpClass[0]
to GCP_CLASS_PREBOUNDLTR to bind the string to left-to-right reading order
before the string. |
GCPCLASS_PREBOUNDRTL |
Set lpClass[0]
to GCP_CLASS_PREBOUNDRTL to bind the string to right-to-left reading order
before the string. |
GCPCLASS_POSTBOUNDLTR |
Set lpClass[0]
to GCP_CLASS_POSTBOUNDLTR to bind the string to left-to-right reading order
after the string. |
GCPCLASS_POSTBOUNDRTL |
Set lpClass[0]
to GCP_CLASS_POSTBOUNDRTL to bind the string to right-to-left reading order
after the string. |
To force the
layout of a character to be carried out in a specific way, preset the
classification for the corresponding array element; the function leaves such
preset classifications unchanged and computes classifications only for array
elements that have been set to zero. Preset classifications are used only if
the GCP_CLASSIN flag is set and the lpclass array is supplied.
If getFontLanguageInfo
does not return GCP_REORDER for the current font, only the GCPCLASS_LATIN value
is meaningful.
lpGlyphs
Pointer to
the array that receives the values identifying the glyphs used for rendering
the string or is NULL if glyph rendering is not needed. The number of glyphs in
the array may be less than the number of characters in the original string if
the string contains ligated glyphs. Also if reordering is required, the order
of the glyphs may not be sequential.
This array is useful if more than one operation is being done on a
string which has any form of ligation, kerning or order-switching. Using the
values in this array for subsequent operations saves the time otherwise
required to generate the glyph indices each time.
This array always contains glyph indices and the ETO_GLYPH_INDEX value
must always be used when this array is used with the ExtTextOut
When GCP_LIGATE is used, you can limit the number of characters that
will be ligated together. (In Arabic for example, three-character ligations are
common). This is done by setting the maximum required in
lpGcpResults->lpGlyphs[0]. If no maximum is required, you should set this
field to zero.
For languages such as Arabic, where GetFontLanguageInfo
nGlyphs
On input,
this member must be set to the size of the arrays pointed to by the array
pointer members. On output, this is set to the number of glyphs filled in, in
the output arrays. If glyph substitution is not
required (that is, each input character maps to exactly one glyph), this member
is the same as it is on input.
nMaxFit
Number of
characters that fit within the extents specified by the nMaxExtent
parameter of the GetCharacterPlacement function. If the GCP_MAXEXTENT or
GCP_JUSTIFY value is set, this value may be less than the number of characters
in the original string. This member is set regardless of whether the
GCP_MAXEXTENT or GCP_JUSTIFY value is given. Unlike nGlyphs, which
specifies the number of output glyphs, nMaxFit refers to the number of
characters from the input string. For Latin SBCS languages, this will be the
same.
Remarks
Whether the lpGlyphs,
lpOutString, or neither is required depends on the results of the GetFontLanguageInfo
In the case
of a font for a language such as English, in which none of the GCP_DBCS,
GCP_REORDER, GCP_GLYPHSHAPE, GCP_LIGATE, GCP_DIACRITIC, or GCP_KASHIDA flags
are returned, neither of the arrays is required for proper operation. (Though
not required, they can still be used. If the lpOutString array is used,
it will be exactly the same as the lpInputString passed to GetCharacterPlacement
In the case
of fonts for languages such as Hebrew, which DO have reordering but do not
typically have extra glyph shapes, lpOutString should be used. This will
give the string on the screen-readable order. However, the lpGlyphs
array is not typically needed. (Hebrew can have extra glyphs, if the
font is a TrueType/Open font.)
In the case
of languages such as Thai or Arabic, in which GetFontLanguageInfo
returns the GCP_GLYPHSHAPE flag, the lpOutString will give the
display-readable order of the string passed to GetCharacterPlacement,
but the values will still be the unshaped characters. For proper display, the lpGlyphs
array must be used.
See Also