The GCP_RESULTS structure contains information about characters in a string. This structure receives the results of the GetCharacterPlacement function. For some languages, the first element in the arrays may contain more, language-dependent information.
typedef struct tagGCP_RESULTS {
DWORD lStructSize;
LPTSTR lpOutString;
UINT *lpOrder;
INT *lpDx;
INT *lpCaretPos;
LPTSTR lpClass;
UINT *lpGlyphs;
UINT nGlyphs;
UINT nMaxFit;
} GCP_RESULTS;
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
function.
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];
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.
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 function.
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
returns the GCP_GLYPHSHAPE flag, the glyphs for a character will be different
depending on whether the character is at the beginning, middle, or end of a
word. Typically, the first character in the input string will also be the
first character in a word, and the last character in the input string will be
treated as the last character in a word. However, if the displayed string is a
subset of the complete string, such as when displaying a section of scrolled
text, this may not be true. In these cases, it is desirable to force the first
or last characters to be shaped as not being initial or final forms. To do
this, again, the first location in the lpGlyphs array is used by
performing an OR operation of the ligation value above with the values
GCPGLYPH_LINKBEFORE and/or GCPGLYPH_LINKAFTER. For example, a value of
GCPGLYPH_LINKBEFORE | 2 means that two-character ligatures are the maximum
required, and the first character in the string should be treated as if it is
in the middle of a word.
Whether the lpGlyphs, lpOutString, or neither is required depends on the results of the GetFontLanguageInfo call.
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.) Note, however, that if GCP_MAXEXTENT is used, then lpOutString will contain the truncated string if it is used, NOT an exact copy of the original.
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.
ExtTextOut, GetCharacterPlacement, GetFontLanguageInfo
file: /Techref/os/win/api/win32/struc/src/str08_16.htm, 14KB, , updated: 2000/4/7 11:20, local time: 2024/12/27 12:47,
18.117.105.184:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://massmind.org/techref/os/win/api/win32/struc/src/str08_16.htm"> GCP_RESULTS</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to massmind.org! |
.