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

简介:
头一次发译的东西,肯定会有不少错误,请大家多多斧正。
本人志在编写中国最出色的输入法,解放中国人的双手。
今从零起步,朝成夕可死也。
 
Input Method Editor
An input method editor (IME) is a program that allows computer users to enter complex characters and symbols, such as Japanese Kanji characters, by using a standard keyboard.
      
输入法编辑器(IME)是一个程序,这个程序允许计算机用户使用标准键盘就能输入复杂的字符与符号,例如日文中的汉字(严重反对!中文是世界上使用人口最多的文字,这里应该是中文才好!)字符。
 
This overview describes the IME and explains how to use the input method manager functions to create and manage IME windows.
 
本预览描述了IME,并且解释说明了如何使用输入法管理程序(IMM)函数来创建和管理IME窗口。
¨         关于输入法编辑器
¨         使用输入法编辑器
¨         输入法编辑器参考
 
About Input Method Editor
The input method editor relieves users of the need to remember all possible character values. Instead, the IME monitors the user's keystrokes, anticipates the characters the user may want, and presents a list of candidate characters from which to choose.
 
       输入法编辑器减轻了用户记住所有可能字符值的需要,取而代之,IME监控用户的击键、预见用户可能期望的字符,并且提供一个可选字符的列表,用户可以从中选择想要的字符。
 
By default, the IME provides an IME window through which users enter keystrokes and view and select candidates. Applications can use the input method manager (IMM) functions and messages to create and manage their own IME windows, providing a custom interface while using the conversion capabilities of the IME.
 
       默认情况下,IME提供了一个IME窗口,通过这个窗口,用户可以用键盘输入并且查看和选择想要的字符。应用程序可以使用输入法管理器(IMM)函数和消息来创建并且管理其自己的IME窗口(比如QQ里是五笔而Word里却是拼音),并在使用IME的转换功能时提供一个自定义接口(不太明白)。
 
IMM is only enabled on East Asian (Chinese, Japanese, Korean) localized Windows. On these systems, call GetSystemMetrics with SM_DBCSENABLED to determine if IMM is enabled. Note that Windows 2000 provides full-featured IME support in all localized language versions, however, that IMM is enabled only when an Asian language pack is installed. An IME-enabled application can call GetSystemMetrics with SM_IMMENABLED to determine if IMM is enabled.
 
       IMM只在东亚(中国,日本,韩国)本地化的Windows中才可用。在这些系统中,以SM_DBCSENABLED消息调用GetSystemMetrics函数来确定IMM是否可用。注意,Windows 2000在所有本地化版本中都提供了全功能的IME支持,然而仅在安装了亚洲语言包的时候IMM才可用。一个IME-enabledIME可用)的程序会以SM_IMMENABLED调用GetSystemMetrics函数来确定IMM是否可用。
 
Status, Composition, and Candidates Windows
The status, composition, and candidates windows form the user interface for the IME. The status window indicates that the IME is open and provides the user the means to set the conversion modes. The composition window appears when the user enters text and, depending on the conversion mode, either displays the text as entered or displays converted text. The candidates window appears in conjunction with the composition window. It contains a list of "candidates" (alternative characters) for the selected character or characters in the composition window. The user can scroll through the candidates list and select the desired characters, then return to the composition window. The user can compose the desired text in this way until the composition string is finalized and the window is closed. The IME sends the composed characters to the application in the form of WM_IME_CHAR or WM_IME_COMPOSITION/GCS_RESULT messages. If the application does not process these messages, the DefWindowProc function translates them into one or more WM_CHAR messages.
 
       状态窗口、字母组合窗口和列选窗口构成了IME的用户界面。状态窗口指示出IME处于开启状态并且提供给用户设置转换模式的方法。字母组合窗口会在用户输入字符的时候出现,其形式基于转换模式,同时显示已经输入的字母或者是已经转换了的字符。(conversion mode转换模式=输入法,比如微软拼音、五笔字型……其实不同的输入法的本质是不同的转换规则。)列选窗口会紧挨着字母组合窗口显示。它包含了一个由“候选条目”构成的列表,此列表匹配选中字符或者是字母组合窗口中的字符。用户可以滚动列选窗口并且选择想要的字符,然后(焦点)返回到字母组合窗口。借此用户可以组合想要的文本直到字符组合成的字符串结束,窗口会关闭。IME将使用WM_IME_CHAR WM_IME_COMPOSITION/GCS_RESULT消息把组合好的字符发送给窗体中的应用程序。如果应用程序没有处理这些消息,DefWindowProc函数会把它们翻译成一条或多条WM_CHAR消息。
 
By default, the system automatically creates and manages status, composition, and candidates windows for all windows that require text input. For many applications, this default processing is sufficient. These applications rely entirely on the system for IME support and are said to be IME-unaware because they are unaware of the many tasks the system carries out to manage the IME windows.
 
       默认情况下,系统会为所有要求输入文本的窗口自动生成并管理状态窗口、字母组合窗口和列选窗口。对于许多程序,这一默认处理已经足够了。这些完全依赖于系统提供IME支持的应用程序称为IME-unawareIME无感知)程序,原因在于它们对系统为管理IME窗口所完成的诸多任务毫无感觉。
 
An IME-aware application, on the other hand, participates in the creation and management of IME windows. Such applications control the operation, position, and appearance of the default windows by sending messages to and by intercepting and processing messages intended for these windows. In some cases, applications create their own IME windows and provide complete processing for their custom status, composition and candidates windows.
 
       相反,一个IME-awareIME感知)程序会参与IME窗口的创建与管理。例如程序可能通过发送或截取消息并且有目的地对这些(IME)窗口消息进行处理,来控制默认(IME)窗口的选项、位置和外观。有些情况下,应用程序会创建它们自己的IME窗口并且对其自定义的状态、字母组合和列选窗口提供完全的控制处理。










本文转自 水之真谛 51CTO博客,原文链接:http://blog.51cto.com/liutiemeng/18885,如需转载请自行联系原作者
目录
相关文章
|
12月前
|
存储 SQL 大数据
告别 Count Distinct 慢查询:StarRocks 高效去重全攻略
在大数据分析中,去重计算(如 Count Distinct)因高计算开销常成为性能瓶颈,尤其在高基数和高并发场景下更为明显。本文以 StarRocks 为分析平台,深入探讨多种去重优化策略,包括使用函数、数据类型转换(如 String 转 Int)、高效数据结构(如 Bitmap 和 HLL),以及物化视图的预计算方案。通过实际案例分析,对比不同方法在性能、精度和易用性方面的优劣,帮助用户在不同业务场景下选择最合适的优化手段。此外,文章还详细解析了如何结合 SQL 查询构建物化视图,以提升去重计算效率,并讨论了精确与近似去重的适用场景。最终目标是为复杂数据分析提供高效、灵活的解决方案。
|
人工智能
【Azure Policy】使用Azure Policy来精准控制资源的创建类型
本文介绍了如何在 Azure 中使用 Azure Policy 的 Deny 策略,阻止创建 AI 服务中的 Document Intelligence 资源。通过定义策略规则,结合资源类型和 Kind 属性,实现精准限制,并附有示例代码及验证结果。
130 0
|
人工智能 自然语言处理 语音技术
2025年国内主流智能客服系统:技术架构与能力深度解析
本文分析了2025年国内智能客服市场的技术格局与系统能力,从核心技术栈(NLP、知识图谱、语音技术等)到市场梯队划分,深入探讨了第一梯队的综合型平台和第二梯队的场景化服务。以合力亿捷为例,剖析其端到端AI技术栈、大模型融合、全渠道融合及运营优化能力,并对比国际顶尖通用AI在语义理解、多模态交互和自主学习方面的启示。最后为企业提供选择智能客服系统的五大考量因素,强调技术与业务场景的深度融合,助力企业实现更高效、智能的客户服务体验。
2364 2
|
easyexcel
easyExcel自定定义类型转换
easyExcel自定定义类型转换
1225 0
|
JSON 前端开发 JavaScript
vite中静态资源(css、img、svg等)的加载机制及其相关配置
【8月更文挑战第3天】vite中静态资源(css、img、svg等)的加载机制及其相关配置
2094 1
|
安全 Linux 开发者
Windows系统历史版本简介
Windows系统历史版本简介
1457 0
|
网络协议 前端开发 Java
springboot整合websorket推送消息实战
springboot整合websorket推送消息实战
586 0
|
Ubuntu IDE 开发工具
轻盈潇洒卓然不群,敏捷编辑器Sublime text 4中文配置Python3开发运行代码环境(Win11+M1 mac)
20世纪初,几乎所有的飞机都是并列双翼结构,此时,美国著名飞行大亨霍华德·休斯认为自己的飞机不够快,助手委婉地提醒他,如果速度太快,飞机的上翼结构支柱很可能会支撑不住,发生断裂。霍华德愤怒地向助手大喊:“谁说我们需要上翼结构?让上翼和支柱见鬼去吧,我们需要的是更轻便的单翼飞机!”于是乎,H1单翼飞机就此出现,这款机型身上体现了霍华德作为一名航空工程师的天才之处:突破性的流线型机身,可收放起落架,轻巧灵动,平面的铆钉和接头以减少空气阻力,因其优美的造型被称为“银色子弹”。 同样地,如果你入职了一家公司,当主管拍拍你的肩膀让你往电脑里安装Pycharm的时候,你也可以愤怒地向他大喊:“谁说我们需要
轻盈潇洒卓然不群,敏捷编辑器Sublime text 4中文配置Python3开发运行代码环境(Win11+M1 mac)
|
IDE Java Nacos
IntelliJ Idea如何将设置tab设置为4个空格
IntelliJ Idea如何将设置tab设置为4个空格
2703 0
IntelliJ Idea如何将设置tab设置为4个空格
|
缓存 运维 前端开发
面试官:平时工作中有没有做过一些性能优化相关的工作呢?
面试官:平时工作中有没有做过一些性能优化相关的工作呢?
面试官:平时工作中有没有做过一些性能优化相关的工作呢?

热门文章

最新文章