网站首页  词典首页

请输入您要查询的函数:

 

术语 getcharacterplacement
释义 GetCharacterPlacement
语法:
DWORD GetCharacterPlacement(
__in HDC hdc,
__in LPCTSTR lpString,
__in int nCount,
__in int nMaxExtent,
__inout LPGCP_RESULTS lpResults,
__in DWORD dwFlags
);
GetCharacterPlacement功能
该GetCharacterPlacement函数检索信息的字符串,如字符宽度,插入定位字符串中的顺序,和字形渲染。在返回的信息类型取决于dwFlags参数,并在指定范围内显示当前选择的字体为基础。该函数复制到指定的GCP_RESULTS结构的信息或由结构指定一个或多个数组。
虽然这个功能曾经为字符串,需要与有越来越多的语言和文字的工作提供足够的已是过时的观念。它已取代由的Uniscribe模块功能。有关更多信息,请参阅的Uniscribe。
建议在一个应用程序使用GetFontLanguageInfo功能,以确定是否GCP_DIACRITIC,GCP_DBCS,GCP_USEKERNING,GCP_LIGATE,GCP_REORDER,GCP_GLYPHSHAPE和GCP_KASHIDA值为当前选定的字体有效。如果没有有效的,GetCharacterPlacement忽略的价值。
该GCP_NODIACRITICS值不再界定,不应使用。
参数
hdc [in]
一个句柄,设备上下文。
lpString [in]
一个字符串处理的指针。字符串不须零终止,自nCount指定字符串的长度。
nCount [in]
该字符串的长度指向lpString。
nMaxExtent [in]
在最大程度上(逻辑单位),以该字符串处理。字符,如果处理的,将超出这个范围将被忽略。计算所需的任何命令或字形阵列只适用于中文字。使用此参数只有在GCP_MAXEXTENT值在dwFlags参数指定。由于函数过程的输入字符串,每个字符和范围添加到输出,范围,以及其他阵列只有在总的范围尚未超过了最大。一旦达到上限,处理将停止。
lpResults [ in , out ]
一个 GCP_RESULTS结构接收函数的结果指针。
dwFlags [in]
指定如何加工成所需的字符串数组。此参数可以是一个或多个下列值。
ValueMeaning
GCP_CLASSINSpecifies该lpClass数组包含的字符预设分类。该分类,可能是因为在输出相同。如果一个字符特定分类不知道,数组中的相应位置,必须设置为零。更多有关的分类信息,请参见GCP_RESULTS。这是非常有用只有GetFontLanguageInfo产生的GCP_REORDER标志。
GCP_DIACRITICDetermines如何标注字符的字符串处理。如果该值未设置,变音符号被视为零宽度字符。例如,希伯来文字符串中可能包含发音符号,但您可能不希望向大家展示。
使用GetFontLanguageInfo,以确定是否字体支持附加符号。如果有,您可以使用或不能使用的调用GCP_DIACRITIC国旗GetCharacterPlacement,对应用程序的需要而定。
GCP_DISPLAYZWGFor语言需要重新安排或形状不同字形的字符上的立场取决于一个词内,nondisplayable经常出现的字符的代码页。例如,在希伯来文代码页,有左到右,右到左的标记,以帮助在输出字符串的字符确定最终的定位。通常这些不显示,并从lpGlyphs和lpDx阵列删除。您可以使用GCP_DISPLAYZWG标志来显示这些字符。
GCP_GLYPHSHAPESpecifies部分或字符串中的所有字符将显示使用的形状以外的其他标准中定义的形状为当前代码页当前选择的字体。如阿拉伯文一些语言,不能支持建立字形,除非指定此值。作为一般规则,如果GetFontLanguageInfo返回此为一个字符串值,这个值必须与GetCharacterPlacement使用。
GCP_JUSTIFYAdjusts在lpDx阵列的程度,使该字符串的长度是一样nMaxExtent相同。 GCP_JUSTIFY只能用于与GCP_MAXEXTENT一起。
GCP_KASHIDAUse Kashidas以及,或代替,调整程度修改字符串的长度,以便它等于由nMaxExtent指定的值。在lpDx阵列,一卡须达指出的是消极的理由索引。 GCP_KASHIDA只能用于与GCP_JUSTIFY和配合,只有字体(和语言)的支持Kashidas。使用GetFontLanguageInfo,以确定是否支持Kashidas当前字体。
使用Kashidas来证明字符串可以导致字形所需数目比字符输入字符串的数目更大。正因为如此,当Kashidas使用,应用程序不能假设设置阵列是输入字符串的大小就足够了。 (最大可能将达到约dxPageWidth / dxAveCharWidth,其中dxPageWidth是该文件的宽度和dxAveCharWidth是从1 GetTextMetrics调用返回的平均字符宽度)。
请注意,只是因为GetFontLanguageInfo返回GCP_KASHIDA标志并不意味着它必须在调用用于GetCharacterPlacement,只是该选项可用。
GCP_LIGATEUse结扎所有字符结扎。阿结扎发生在一字形是两个或多个字符使用。例如,字母A和E可结扎呢?。为此要使用,但是,无论是语言支持和字体必须支持所需的字型(例子不会英语默认处理)。
使用GetFontLanguageInfo,以确定是否支持当前字体结扎。如果没有一个特定的最高要求的字符数将结扎,设置在lpGlyphs数组的第一个元素的数量。如果正常的结扎需要,设置此值为0。如果没有指定GCP_LIGATE,没有结扎会发生。更多信息见GCP_RESULTS。
如果GCP_REORDER值通常所必需的字符集,但没有指定,输出将毫无意义,除非被串在已经订购的视觉是通过(即,认为可以打进lpGcpResults投入的结果,“在一个调用lpOutString GetCharacterPlacement是第二个电话输入字符串)。
请注意,只是因为GetFontLanguageInfo返回GCP_LIGATE标志并不意味着它必须在调用用于GetCharacterPlacement,只是该选项可用。
字符串的仅造成程度的长期逻辑单位,GCP_MAXEXTENTCompute程度,不超过该nMaxExtent参数指定的值。
GCP_NEUTRALOVERRIDECertain语言只。重写中立正常处理和对待强劲的字符相匹配的字符串的阅读顺序。有用只与GCP_REORDER标志。
GCP_NUMERICOVERRIDECertain语言只。重写numerics正常处理和对待强劲的字符相匹配的字符串的阅读顺序。有用只与GCP_REORDER标志。
GCP_NUMERICSLATINArabic /泰国只。使用标准的拉丁字型的数量和覆盖系统默认的。要确定此选项可在字体的语言,使用GetStringTypeEx看看语言支持一个以上的数字格式。
GCP_NUMERICSLOCALArabic /泰国只。利用当地字形的数字字符和覆盖系统默认的。要确定此选项可在字体的语言,使用GetStringTypeEx看看语言支持一个以上的数字格式。
GCP_REORDERReorder字符串。使用的语言不属于半角左到右的阅读顺序。如果该值未指定,字符串被假定为已在显示顺序。
如果此标志是闪米特语言和lpClass是使用数组,前两个数组的元素是用来指定字符串以外的边界的阅读顺序。 GCP_CLASS_PREBOUNDRTL和GCP_CLASS_PREBOUNDLTR可以用来设置命令。如果没有预设的命令需要,设置值为0。这些值可与若GCPCLASSIN标志设置其他值。
如果GCP_REORDER值没有指定,lpString参数是必须是可视化的地方,这是使用的语言命令,以及lpOutString和lpOrder领域被忽略。
使用GetFontLanguageInfo,以确定是否重新安排当前字体支持。
GCP_SYMSWAPOFFSemitic语言只。指定交换的字符不重置。例如,在从右到左字符串,'('和')'不发生逆转。
在字体GCP_USEKERNINGUse字距对(如有的话)在创建宽度阵列。使用GetFontLanguageInfo,以确定是否支持当前字体字距对。
请注意,只是因为GetFontLanguageInfo返回GCP_USEKERNING标志并不意味着它必须在调用用于GetCharacterPlacement,只是该选项可用。大多数的TrueType字体有一个字距表,但您没有使用它。
建议在一个应用程序使用GetFontLanguageInfo功能,以确定是否GCP_DIACRITIC,GCP_DBCS,GCP_USEKERNING,GCP_LIGATE,GCP_REORDER,GCP_GLYPHSHAPE和GCP_KASHIDA值为当前选定的字体有效。如果没有有效的,GetCharacterPlacement忽略的价值。
该GCP_NODIACRITICS值不再界定,不应使用。
返回值
如果函数成功,返回值是宽度和逻辑单位弦高。宽度是低位字,高度为高位字。
如果函数失败,返回值是零。
备注
GetCharacterPlacement确保应用程序可以正确地处理文字,不管国际环境和现有的字体类型。应用程序使用的ExtTextOut在使用功能和功能的GetTextExtentPoint32这个函数的地方(偶尔在GetCharWidth32和GetCharABCWidths职能的)。
使用GetCharacterPlacement字符间的间隔检索和索引数组并不总是必要的,除非理由或调整是必需的。对于非拉丁字体,应用程序可以提高速度而ExtTextOut函数呈现文本检索使用GetCharacterPlacement在调用ExtTextOut的字符间的间隔和索引数组。这是特别有用当呈现相同的文字重复或使用字符间的间隔的位置,插入符号。如果lpGlyphs输出数组是在对ExtTextOut调用中使用的ETO_GLYPH_INDEX必须设置标志。
GetCharacterPlacement检查lpOrder,lpDX,lpCaretPos,lpOutString,以及GCP_RESULTS结构lpGlyphs成员和填充,如果这些成员没有设置为NULL相应的数组。如果GetCharacterPlacement无法填补一个数组,它设置相应的成员为NULL。为了确保有效的信息检索,应用程序负责调用之前设置的功能和检查后,调用成员的值的成员,一个有效的地址。如果GCP_JUSTIFY或GCP_USEKERNING值指定,lpDX和/或lpCaretPos成员必须拥有有效的地址。
请注意,在GCP_RESULTS.lpGlyphs产生的字形指标是特定的设备上下文当前字体,并应只能用于绘制的设备上下文文字的字体,而仍然选择。
当计算的理由,如果在字符串中的尾随空格字符,功能降低字符串的长度,并删除之前的空间计算的理由。如果数组只包含空格,该函数返回一个错误。
ExtTextOut预计为每一个字节lpDX DBCS字符串项,而GetCharacterPlacement指定为每个字型lpDX项。要纠正这种不匹配时,使用此功能的组合,要么使用GetGlyphIndices或扩大零lpDX数组相应对DBCS字节对第二个字节宽度项。
如果逻辑宽度比在输入字符串主角宽度小于,GCP_RESULTS.nMaxFit返回错误值。对于这种情况下,字形指标和lpDX数组调用GetCharacterPlacement。然后使用lpDX数组做的范围内计算使用每个字符,其中nMaxFit是字符数,其字形指标提前宽度比主角宽度小于前进宽度。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWingdi.h(头文件:winuser.h)
LibraryGdi32.lib
DLLGdi32.dll
Unicode和ANSI namesGetCharacterPlacementW(Unicode)和GetCharacterPlacementA(ANSI)的
参见
字体和文字概述
字体和文本函数
ExtTextOut
GCP_RESULTS
GetCharABCWidths
GetCharWidth32
GetFontLanguageInfo
GetStringTypeEx
GetTextExtentPoint32
GetTextMetrics
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月11日
==英文原文==GetCharacterPlacement Function
The GetCharacterPlacement function retrieves information about a character string, such as character widths, caret positioning, ordering within the string, and glyph rendering. The type of information returned depends on the dwFlags parameter and is based on the currently selected font in the specified display context. The function copies the information to the specified GCP_RESULTS structure or to one or more arrays specified by the structure.
Although this function was once adequate for working with character strings, a need to work with an increasing number of languages and scripts has rendered it obsolete. It has been superseded by the functionality of the Uniscribe module. For more information, see Uniscribe .
It is recommended that an application use the GetFontLanguageInfo function to determine whether the GCP_DIACRITIC, GCP_DBCS, GCP_USEKERNING, GCP_LIGATE, GCP_REORDER, GCP_GLYPHSHAPE, and GCP_KASHIDA values are valid for the currently selected font. If not valid, GetCharacterPlacement ignores the value.
The GCP_NODIACRITICS value is no longer defined and should not be used.
Syntax
DWORD GetCharacterPlacement(
__in HDC hdc,
__in LPCTSTR lpString,
__in int nCount,
__in int nMaxExtent,
__inout LPGCP_RESULTS lpResults,
__in DWORD dwFlags
);
Parameters
hdc [in]
A handle to the device context.
lpString [in]
A pointer to the character string to process. The string does not need to be zero-terminated, since nCount specifies the length of the string.
nCount [in]
The length of the string pointed to by lpString.
nMaxExtent [in]
The maximum extent (in logical units) to which the string is processed. Characters that, if processed, would exceed this extent are ignored. Computations for any required ordering or glyph arrays apply only to the included characters. This parameter is used only if the GCP_MAXEXTENT value is specified in the dwFlags parameter. As the function processes the input string, each character and its extent is added to the output, extent, and other arrays only if the total extent has not yet exceeded the maximum. Once the limit is reached, processing will stop.
lpResults [in, out]
A pointer to a GCP_RESULTS structure that receives the results of the function.
dwFlags [in]
Specifies how to process the string into the required arrays. This parameter can be one or more of the following values.
ValueMeaning
GCP_CLASSINSpecifies that the lpClass array contains preset classifications for characters. The classifications may be the same as on output. If the particular classification for a character is not known, the corresponding location in the array must be set to zero. for more information about the classifications, see GCP_RESULTS. This is useful only if GetFontLanguageInfo returned the GCP_REORDER flag.
GCP_DIACRITICDetermines how diacritics in the string are handled. If this value is not set, diacritics are treated as zero-width characters. For example, a Hebrew string may contain diacritics, but you may not want to display them.
Use GetFontLanguageInfo to determine whether a font supports diacritics. If it does, you can use or not use the GCP_DIACRITIC flag in the call to GetCharacterPlacement, depending on the needs of your application.
GCP_DISPLAYZWGFor languages that need reordering or different glyph shapes depending on the positions of the characters within a word, nondisplayable characters often appear in the code page. For example, in the Hebrew code page, there are Left-To-Right and Right-To-Left markers, to help determine the final positioning of characters within the output strings. Normally these are not displayed and are removed from the lpGlyphs and lpDx arrays. You can use the GCP_DISPLAYZWG flag to display these characters.
GCP_GLYPHSHAPESpecifies that some or all characters in the string are to be displayed using shapes other than the standard shapes defined in the currently selected font for the current code page. Some languages, such as Arabic, cannot support glyph creation unless this value is specified. As a general rule, if GetFontLanguageInfo returns this value for a string, this value must be used with GetCharacterPlacement.
GCP_JUSTIFYAdjusts the extents in the lpDx array so that the string length is the same as nMaxExtent. GCP_JUSTIFY may only be used in conjunction with GCP_MAXEXTENT.
GCP_KASHIDAUse Kashidas as well as, or instead of, adjusted extents to modify the length of the string so that it is equal to the value specified by nMaxExtent. In the lpDx array, a Kashida is indicated by a negative justification index. GCP_KASHIDA may be used only in conjunction with GCP_JUSTIFY and only if the font (and language) support Kashidas. Use GetFontLanguageInfo to determine whether the current font supports Kashidas.
Using Kashidas to justify the string can result in the number of glyphs required being greater than the number of characters in the input string. Because of this, when Kashidas are used, the application cannot assume that setting the arrays to be the size of the input string will be sufficient. (The maximum possible will be approximately dxPageWidth/dxAveCharWidth, where dxPageWidth is the width of the document and dxAveCharWidth is the average character width as returned from a GetTextMetrics call).
Note that just because GetFontLanguageInfo returns the GCP_KASHIDA flag does not mean that it has to be used in the call to GetCharacterPlacement, just that the option is available.
GCP_LIGATEUse ligations wherever characters ligate. A ligation occurs where one glyph is used for two or more characters. For example, the letters a and e can ligate to ?. For this to be used, however, both the language support and the font must support the required glyphs (the example will not be processed by default in English).
Use GetFontLanguageInfo to determine whether the current font supports ligation. If it does and a specific maximum is required for the number of characters that will ligate, set the number in the first element of the lpGlyphs array. If normal ligation is required, set this value to zero. If GCP_LIGATE is not specified, no ligation will take place. See GCP_RESULTS for more information.
If the GCP_REORDER value is usually required for the character set but is not specified, the output will be meaningless unless the string being passed in is already in visual ordering (that is, the result that gets put into lpGcpResults->lpOutString in one call to GetCharacterPlacement is the input string of a second call).
Note that just because GetFontLanguageInfo returns the GCP_LIGATE flag does not mean that it has to be used in the call to GetCharacterPlacement, just that the option is available.
GCP_MAXEXTENTCompute extents of the string only as long as the resulting extent, in logical units, does not exceed the values specified by the nMaxExtent parameter.
GCP_NEUTRALOVERRIDECertain languages only. Override the normal handling of neutrals and treat them as strong characters that match the strings reading order. Useful only with the GCP_REORDER flag.
GCP_NUMERICOVERRIDECertain languages only. Override the normal handling of numerics and treat them as strong characters that match the strings reading order. Useful only with the GCP_REORDER flag.
GCP_NUMERICSLATINArabic/Thai only. Use standard Latin glyphs for numbers and override the system default. To determine if this option is available in the language of the font, use GetStringTypeEx to see if the language supports more than one number format.
GCP_NUMERICSLOCALArabic/Thai only. Use local glyphs for numeric characters and override the system default. To determine if this option is available in the language of the font, use GetStringTypeEx to see if the language supports more than one number format.
GCP_REORDERReorder the string. Use for languages that are not SBCS and left-to-right reading order. If this value is not specified, the string is assumed to be in display order already.
If this flag is set for Semitic languages and the lpClass array is used, the first two elements of the array are used to specify the reading order beyond the bounds of the string. GCP_CLASS_PREBOUNDRTL and GCP_CLASS_PREBOUNDLTR can be used to set the order. If no preset order is required, set the values to zero. These values can be combined with other values if the GCPCLASSIN flag is set.
If the GCP_REORDER value is not specified, the lpString parameter is taken to be visual ordered for languages where this is used, and the lpOutString and lpOrder fields are ignored.
Use GetFontLanguageInfo to determine whether the current font supports reordering.
GCP_SYMSWAPOFFSemitic languages only. Specifies that swappable characters are not reset. For example, in a right-to-left string, the '(' and ')' are not reversed.
GCP_USEKERNINGUse kerning pairs in the font (if any) when creating the widths arrays. Use GetFontLanguageInfo to determine whether the current font supports kerning pairs.
Note that just because GetFontLanguageInfo returns the GCP_USEKERNING flag does not mean that it has to be used in the call to GetCharacterPlacement, just that the option is available. Most TrueType fonts have a kerning table, but you do not have to use it.

It is recommended that an application use the GetFontLanguageInfo function to determine whether the GCP_DIACRITIC, GCP_DBCS, GCP_USEKERNING, GCP_LIGATE, GCP_REORDER, GCP_GLYPHSHAPE, and GCP_KASHIDA values are valid for the currently selected font. If not valid, GetCharacterPlacement ignores the value.
The GCP_NODIACRITICS value is no longer defined and should not be used.
Return Value
If the function succeeds, the return value is the width and height of the string in logical units. The width is the low-order word and the height is the high-order word.
If the function fails, the return value is zero.
Remarks
GetCharacterPlacement ensures that an application can correctly process text regardless of the international setting and type of fonts available. Applications use this function before using the ExtTextOut function and in place of the GetTextExtentPoint32 function (and occasionally in place of the GetCharWidth32 and GetCharABCWidths functions).
Using GetCharacterPlacement to retrieve intercharacter spacing and index arrays is not always necessary unless justification or kerning is required. For non-Latin fonts, applications can improve the speed at which the ExtTextOut function renders text by using GetCharacterPlacement to retrieve the intercharacter spacing and index arrays before calling ExtTextOut. This is especially useful when rendering the same text repeatedly or when using intercharacter spacing to position the caret. If the lpGlyphs output array is used in the call to ExtTextOut, the ETO_GLYPH_INDEX flag must be set.
GetCharacterPlacement checks the lpOrder, lpDX, lpCaretPos, lpOutString, and lpGlyphs members of the GCP_RESULTS structure and fills the corresponding arrays if these members are not set to NULL. If GetCharacterPlacement cannot fill an array, it sets the corresponding member to NULL. To ensure retrieval of valid information, the application is responsible for setting the member to a valid address before calling the function and for checking the value of the member after the call. If the GCP_JUSTIFY or GCP_USEKERNING values are specified, the lpDX and/or lpCaretPos members must have valid addresses.
Note that the glyph indexes returned in GCP_RESULTS.lpGlyphs are specific to the current font in the device context and should only be used to draw text in the device context while that font remains selected.
When computing justification, if the trailing characters in the string are spaces, the function reduces the length of the string and removes the spaces prior to computing the justification. If the array consists of only spaces, the function returns an error.
ExtTextOut expects an lpDX entry for each byte of a DBCS string, whereas GetCharacterPlacement assigns an lpDX entry for each glyph. To correct this mismatch when using this combination of functions, either use GetGlyphIndices or expand the lpDX array with zero-width entries for the corresponding second byte of a DBCS byte pair.
If the logical width is less than the width of the leading character in the input string, GCP_RESULTS.nMaxFit returns a bad value. For this case, call GetCharacterPlacement for glyph indexes and the lpDX array. Then use the lpDX array to do the extent calculation using the advance width of each character, where nMaxFit is the number of characters whose glyph indexes advance width is less than the width of the leading character.
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWingdi.h (include Windows.h)
LibraryGdi32.lib
DLLGdi32.dll
Unicode and ANSI namesGetCharacterPlacementW (Unicode) and GetCharacterPlacementA (ANSI)
See Also
Fonts and Text Overview
Font and Text Functions
ExtTextOut
GCP_RESULTS
GetCharABCWidths
GetCharWidth32
GetFontLanguageInfo
GetStringTypeEx
GetTextExtentPoint32
GetTextMetrics
Send comments about this topic to Microsoft
Build date: 7/11/2009
==原始网址==http://msdn.microsoft.com/en-us/library/dd144860(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 11:32:01