分享
 
 
 

输入法编辑器(IME)程序设计(3)

王朝vc·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

Composition String

The composition string is the current text in the composition window. This is the text that the IME converts to final characters. Each composition string consists of one or more clauses, where a clause is the smallest combination of characters that the IME can convert to a final character. To get and set the composition string, call the ImmGetCompositionString and ImmSetCompositionString functions.

As the user enters text in the composition window, the IME tracks the status of the composition string. This status includes attribute information, clause information, typing information, and cursor position. You can retrieve the composition status by using the ImmGetCompositionString function.

In the attribute information array, all characters of one clause must have the same attribute. The attribute information is an array of 8-bit values that specifies the status of characters in the composition string. There is one value for each byte in the string, including one byte each for the lead and second bytes of any double-byte characters in the string. For each value in the array, bits 0 through 3 can be one combination of the following values.

字母组合字符串(composition string)是指字母组合窗口中的当前文本。这是将被IME转换为最终字符的文本。每个字母组合字符串由一个或多个子串组成(clauses),子串是IME能转换成最终字符的最小字符组合。要获取或设置字母组合字符串,调用ImmGetCompositionString 和ImmSetCompositionString函数。

当用户在字母组合窗口中输入文本时,IME会跟踪字母组合字符串的状态。这些状态包括属性信息、子串信息、录入信息和子串的位置。你可以通过使用ImmGetCompositionString函数来检索字母组合的状态。

在属性信息数组中,同一个子串中的所有字母都必须具有相同的属性。属性信息是一个由8位值组成的数组,用于确定字母组合字符串中的字符。字符串中的每个字节都对应有一个值,其中,字符串中每个双字节字符的第一和第二字节也都对应的一个值。数组中的每个值,从第0位到第3位可以是下面各值的组合:

Value(值)

Meaning(含意)

ATTR_INPUT

Character being entered by the user. It is yet to be converted by the IME.

用户输入的字符。它将被IME转换。

ATTR_INPUT_ERROR

Character is an error character and cannot be converted by the IME. For example, some consonants cannot be put together.

字符是一个错误的字符,不能被IME所转换。使用某些辅音字母不能放在一起。

ATTR_TARGET_CONVERTED

Character converted by the IME. The user has selected this character and the IME has converted it.

被IME所转换了的字符。用户已经选择了这个字符并且IME已经将其转换。

ATTR_CONVERTED

A converted character. The IME has already converted this character.

一个已经转换了的字符。IME已经将其转换。

ATTR_TARGET_NOTCONVERTED

Character being converted. The user has selected this character but the IME has not yet converted it.

正在转换中的字符。用户已经选择了这个字符,但是IME还没有转换它。

ATTR_FIXEDCONVERTED

Characters that will not be converted. The IME will not convert these characters anymore.

不能被转换的字符。IME将不能再对其转换。

All other values are reserved. In Japanese, any unconverted character having the ATTR_INPUT attribute is a Hiragana, Katakana, or alphanumeric character. In Korean, this character is a Hangeul character that is not converted by IME yet. In Traditional and Simplified Chinese, each IME may limit its character in some range.

其它值(大概是指8位中的)将被保留。在日文中,任何拥有ATTR_INPUT属性而不能被转换的字符都是一个平假名、片假名是数字字母。在韩文中,这样的字符是一个韩文字符,它也不能被IME所转换。在传统(也就是繁体)和简体中文中,各个IME(大概是指各个输入法)会以自己的范围内限制它的字符。

The clause information is an array of 32-bit values that specifies the positions of the clauses in the composition string. There is one value for each clause and a final value that specifies the length of the full string. Each value in the array specifies the offset, in bytes, from the beginning of the string to the clause. The first value is always 0 because the first clause always starts at the beginning of the string. For example, if a string has two clauses, the clause information has three values: the first value is 0, the second value is the offset of the second clause, and the third value is the length of the string. For Unicode, the position of a clause is the position counted in Unicode characters, and the length of a string is the size in Unicode characters.

子串信息是一个32位值的数组,用于确定子串在字母组合字符串中的位置。每个子串对应一个值,最后一个值确定整个字母组合字符串的长度。数组中的每个值在字节级别上(以字节为单位)确定了子串由字符串算起的偏移量。第一个值总是0,因为第一个子串总是从字符串的起点开始。例如,如果字符串有两个子串,子串消息(数组)就会有三个值:第一个值是0,第二个值是第二个子串的偏移量,第三个值是字符串的长度。对于Unicode,子串的位置是用Unicode字符计算出的位置,并且字符串的长度也是以Unicode字符计数。

The typing information is a null-terminated character string representing the characters entered at the keyboard.

The cursor position is a value indicating the position of the cursor relative to the characters in the composition string. The value is the offset, in bytes, from the beginning of the string. If this value is 0, the cursor is immediately before the first character in the string. If the value is equal to the length of the string, the cursor is immediately after the last character. If –1, the cursor is not present. For Unicode, both position and length are measured in Unicode characters.

录入信息是一个无终结字符(null-terminated character)字符串,代表由键盘输入的字符。光标位置(cursor position)是一个值,它指出光标相对于字母组合字符串中字符的位置。此值是个以字节计算的偏移量,从字符串的起点算起。如果值与字符串的长度相等,光标恰好处在最后一个字符的后面。如果值为-1,意味着没有光标(光标不显示)。对于Unicode,位置和长度都是以Unicode字符来度量的。

You can set the composition string or elements of the composition status by using the ImmSetCompositionString function. To ensure that the composition window updates its appearance based on these changes, the function allows you to send a notification message to the window. Applications that set a combination of composition status elements typically set the fNotify parameter to FALSE for all but the last call to this function so that only one notification message is generated for the composition window.

Finally, the edit control supports two messages for changing the IME's handling of composition strings. For more information, see EM_GETIMESTATUS and EM_SETIMESTATUS. For more information on the edit control, see Edit Controls.

你可以使用ImmSetCompositionString函数来设置字母组合字符串或者其中元素的属性。为了确保字母组合窗口已经根据这些改变更新了它的外观显示,函数允许你向窗口发送一个通知消息。设定字母组合字符串状态元素组合的应用程序,默认情况下会把所有对此函数调用中的fNotify参数设置为FASLE,除了最后一个调用,所以对字母组合窗口只会生成一个通知消息。

最后,编辑控件还支持两个IME的字母组合字符串处理消息。更多信息,参见EM_GETIMESTATUS 和 EM_SETIMESTATUS。更多有关编辑控件的信息,参见Edit Controls。

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有