自訂輸入方法編輯器 (IME) 需求Custom Input Method Editor (IME) requirements

這些指導方針和需求可協助您開發自訂輸入方法編輯器 (IME) 協助使用者輸入無法在標準的標準鍵盤上輕鬆呈現的文字。These guidelines and requirements can help you to develop a custom Input Method Editor (IME) to help a user input text in a language that can't be represented easily on a standard QWERTY keyboard.

如需 Ime 的總覽,請參閱 輸入法編輯器 (IME) For an overview of IMEs, see Input Method Editor (IME).

預設 IMEDefault IME

使用者可以選取任何使用中的 Ime (設定-> 時間 & 語言 > 語言 > 慣用語言 > 語言套件-選項) 為慣用語言的預設 IME。A user can select any of their active IMEs (Settings -> Time & Language -> Language -> Preferred languages -> Language pack - Options) to be the default IME for their preferred language.

慣用語言設定

在慣用語言的 [語言選項設定] 畫面上,選取預設鍵盤。Select the default keyboard on the Language options settings screen for the preferred language.

慣用語言鍵盤

重要

我們不建議直接寫入登錄來為您的自訂 IME 設定預設鍵盤。We do not recommend writing directly to the registry to set the default keyboard for your custom IME.

相容性需求Compatibility requirements

以下是自訂 IME 的基本相容性需求。The following are the basic compatibility requirements for a custom IME.

IME 必須與 Windows 應用程式相容IME must be compatible with Windows apps

使用 文字服務架構 (TSF) 來執行 ime。Use the Text Services Framework (TSF) to implement IMEs. 先前,您可以選擇使用輸入服務的 輸入方法管理員 (IMM32) Previously, you had the option of using the Input Method Manager (IMM32) for input services. 現在系統會封鎖使用輸入方法管理員執行的 Ime (IMM32) 。Now the system blocks IMEs that are implemented by using Input Method Manager (IMM32).

當應用程式啟動時,TSF 會針對使用者目前選取的 IME 載入 IME DLL。When an app starts, TSF loads the IME DLL for the IME that's currently selected by the user. 當 IME 載入時,會受限於與應用程式相同的應用程式容器限制。When an IME is loaded, it's subject to the same app container restrictions as the app. 例如,如果應用程式未在其資訊清單中要求網際網路存取,則 IME 無法存取網際網路。For example, an IME can't access the Internet if an app hasn't requested Internet access in its manifest. 此行為可確保 Ime 無法違反安全性合約。This behavior ensures that IMEs can't violate security contracts.

TSF 是應用程式與您的 IME 之間的媒介。TSF is the intermediary between the app and your IME. TSF 會將輸入事件傳達給輸入法,並在使用者選取字元之後,從 IME 接收輸入字元。TSF communicates input events to the IME and receives input characters back from the IME after the user has selected a character.

這種行為與舊版 Windows 相同,但載入至 Windows 應用程式會影響 IME 的潛在功能。This behavior is the same as previous versions of Windows, but being loaded into a Windows app affects the potential capabilities of an IME.

如果您的輸入需要在 Windows 應用程式與桌面應用程式之間提供不同的功能或 UI,請確定 TSF 所載入的 DLL 會檢查所載入的應用程式類型。If your IME needs to provide different functionality or UI between Windows apps and desktop apps, ensure that the DLL that’s loaded by TSF checks which type of app it's being loaded into. 在您的 IME 中呼叫 ITfThreadMgrEx:: GetActiveFlags 方法,並檢查 TF_TMF_IMMERSIVEMODE 旗標,讓您的 ime 依據結果觸發不同的應用程式邏輯。Call the ITfThreadMgrEx::GetActiveFlags method in your IME and check the TF_TMF_IMMERSIVEMODE flag, so your IME triggers different application logic depending on the result.

Windows 應用程式不支援 (TTS) Ime 的資料表文字服務。Windows apps do not support Table Text Service (TTS) IMEs.

注意

產生 TTS Ime 的一些工具會產生由 Windows 標示為惡意程式碼的 Ime。Some tools for generating TTS IMEs produce IMEs that are marked as malware by Windows.

IME 必須與系統匣相容IME must be compatible with the system tray

沒有可裝載 IME 圖示的語言列。There is no language bar to host IME icons. 相反地,系統匣會顯示指出目前輸入選項的輸入指標。Instead, an Input Indicator shows on the system tray that indicates the current input option. 輸入指標只會顯示 IME 標記圖示,以指出目前執行中的 IME。The Input Indicator shows only the IME branding icon to indicate the currently running IME. 此外,也有一個 IME 模式圖示會顯示在輸入法商標圖示的左邊,讓使用者可以執行最常用的 IME 模式參數,例如開啟或關閉 IME。Also, there's one IME mode icon that shows on the left of the IME branding icon for users to perform the most commonly used IME mode switch, like turning the IME on or off.

輸入指標只會顯示相容 Ime 的輸入法商標圖示和模式圖示。The Input Indicator shows the IME branding icon and mode icon only for compatible IMEs. 不相容的 Ime 沒有顯示在系統匣中的商標圖示和模式圖示。IMEs that aren't compatible don't have the branding icon and mode icon displayed in the system tray. 相反地,輸入指標會顯示語言縮寫,而不是輸入法商標圖示。Instead, the Input Indicator shows the language abbreviation instead of the IME branding icon.

將輸入法圖示儲存在 DLL 或 EXE 檔案中,而不是獨立的 .ico 檔案。Store the IME icons in a DLL or EXE file, instead of a standalone .ico file. 輸入法圖示的設計必須遵循下列 UI 設計指導方針一節所述的指導方針。The design of IME icons must follow the guidelines described in the following UI design guidelines section.

IME 商標圖示IME branding icon

輸入指標會使用 IME 在系統上註冊時所定義的資源識別碼,從 IME DLL 取得輸入法商標圖示。The Input Indicator gets the IME branding icon from the IME DLL by using the resource ID defined by the IME when it was registered on the system.

IME 模式圖示IME mode icon

某些 Ime 可能需要依賴顯示在系統匣上的輸入指標來顯示 IME 模式圖示。Some IMEs may need to rely on the Input Indicator showing on the system tray to display the IME mode icon. 在此情況下,IME 會使用 GUID_LBI_INPUTMODE,將輸入法模式圖示傳遞給輸入指標。In this case, the IME passes the IME mode icon to the Input Indicator by using GUID_LBI_INPUTMODE.

將 IME 模式圖示傳遞至系統匣上的輸入指標時,IME 模式圖示的預設大小為16x16 圖元。When passing the IME mode icons to the Input Indicator on the system tray, the default size of the IME mode icon is 16x16 pixels. UI 調整會遵循 DPI。The UI scaling follows DPI.

當將輸入法模式圖示傳遞至 UAC 上的輸入指標時 (在安全桌面) 的使用者帳戶控制,IME 模式圖示的預設大小為20x20 圖元。When passing the IME mode icon to the Input Indicator on UAC (User Account Control in Secure Desktop), the default size of the IME mode icon is 20x20 pixels. UAC 上輸入法模式圖示的 UI 調整會遵循 PPI。The UI scaling for IME mode icon on UAC follows PPI.

IME 必須在應用程式容器中運作IME must work in app container

某些 IME 函數會在應用程式容器中受到影響。Some IME functions are affected in an app container.

  • 字典 檔-通常,ime 有唯讀的字典檔案,可將使用者輸入對應至特定字元。Dictionary Files - Frequently, IMEs have read-only dictionary files to map user input to specific characters. 若要從應用程式容器記憶體取這些檔案,您的 IME 必須將它們放在 Program Files 或 Windows 目錄下。To access these files from inside an app container, your IME must place them under the Program Files or Windows directories. 根據預設,這些目錄可以從應用程式容器讀取,因此 Ime 可以存取儲存在這些位置中的字典檔。By default, these directories can be read from an app container, so IMEs can access dictionary files that are stored in these locations. 如果您的輸入檔必須將字典檔案儲存在其他位置,則必須明確操作字典檔案 (ACL) 的存取控制清單 ,以允許從應用程式容器進行存取。If your IME must store the dictionary file somewhere else, it must explicitly manipulate the Access Control Lists (ACL) of the dictionary files to allow access from app containers.
  • 網際網路更新 -如果您的 IME 需要使用來自網際網路的資料來更新其字典,它無法在應用程式容器內可靠地這麼做,因為不一定會允許網際網路存取。Internet Updating - If your IME needs to update its dictionaries using data from the Internet, it can't reliably do so inside an app container, because Internet access isn't always permitted. 相反地,您的 IME 應該執行個別的桌面進程,負責以網際網路的資料更新字典檔案。Instead, your IME should run a separate desktop process that's responsible for updating the dictionary files with data from the Internet.
  • 即時學習-如果輸入法是在可存取網際網路的應用程式容器中執行,則輸入法可以進行通訊的端點沒有限制。On-the-fly learning - If an IME is running in an app container that has Internet access, there's no restriction on the endpoints that the IME can communicate with. 在此情況下,IME 可以使用雲端伺服器來提供即時學習服務。In this case, an IME can use a cloud server to provide on-the-fly learning services. 某些 Ime 會在使用者輸入時,即時下載並上傳使用者輸入。Some IMEs download and upload user input on the fly, while the user is typing. 由於應用程式容器無法保證網際網路存取,因此不一定會允許這種情況。Since Internet access is not guaranteed in an app container, this may not always be allowed.
  • 進程之間共用資訊-ime 可能需要在不同應用程式容器中的應用程式之間共用使用者輸入喜好設定的相關資料。Sharing information between processes - IMEs may need to share data about the user’s input preferences between apps that are in different app containers. 使用 web 服務在應用程式之間共用資料。Use a web service to share data between apps.

重要

如果您嘗試規避應用程式容器安全性規則,您的 IME 可能會被視為惡意程式碼和封鎖。If you try to circumvent app container security rules, your IME may be treated as malware and blocked.

IME 和觸控鍵盤IME and touch keyboard

您的 IME 必須確保其候選窗格的 UI 和其他 UI 元素不會在觸控鍵盤底下繪製。Your IME must ensure that its candidate pane's UI, and other UI elements, aren't drawn underneath the touch keyboard. 觸控鍵盤會顯示在與所有應用程式較高的 z 順序頻外,而且 IME UI 會顯示在其作用中應用程式所在的相同 z 順序寬線中。The touch keyboard is displayed in a higher z-order band than all apps, and the IME UI is displayed in the same z-order band as the app it's active in. 如此一來,觸控鍵盤可以重迭並隱藏 IME UI。As a result, the touch keyboard can overlap and hide the IME UI. 在大部分情況下,應用程式應調整其視窗的大小,以考慮觸控鍵盤。In most cases, the app should resize its window to account for the touch keyboard. 如果應用程式未調整大小,則 IME 仍可使用 InputPane API 來取得觸控鍵盤的位置。If an app doesn't resize, the IME still can use the InputPane API to get the position of the touch keyboard. IME 會查詢 Location 屬性,或註冊觸控鍵盤的顯示和隱藏事件的處理常式。The IME queries the Location property, or it registers a handler for the touch keyboard's Show and Hide events. 每次使用者按下編輯欄位時都會引發 Show 事件,即使目前顯示的是觸摸鍵盤也是一樣。The Show event is raised every time the user taps in an edit field, even if the touch keyboard is displayed currently. 您的 IME 可以使用此 API 來取得觸控鍵盤用的螢幕空間,在 IME 繪製候選 (或其他) UI 之前,以及重新排列 Ime UI,以避免在觸摸鍵盤下繪製。Your IME can use this API to get the screen space used by the touch keyboard before the IME draws candidate (or other) UI, and to reflow the IMEs UI to avoid drawing beneath the touch keyboard.

指定慣用的觸控鍵盤配置Specifying the preferred touch keyboard layout

IME 可指定要使用的觸控鍵盤配置,並啟用 IME 以使用觸控優化的版面配置。The IME can specify which touch keyboard layout to use, and the IME is enabled to work with touch-optimized layouts. 這項功能僅適用于韓文、日文、簡體中文和繁體中文輸入語言的 Ime。This functionality is limited to IMEs for the Korean, Japanese, Chinese Simplified, and Chinese Traditional input languages.

觸控鍵盤支援七種版面配置,其中三種是傳統版面配置,其中四個是觸控優化的版面配置。There are seven layouts supported by the touch keyboard, three of which are classic layouts and four of which are touch-optimized layouts. 傳統版面配置的外觀和行為就像實體鍵盤一樣。The classic layouts look and behave like a physical keyboard.

這三種典型的版面配置都是用不同的形式來輸入繁體中文:All of the three classic layouts are for inputting traditional Chinese in different forms:

  • 以語音為基礎的輸入Phonetic-based input
  • 倉頡輸入Changjie input
  • Dayi 輸入Dayi input

除了傳統版面配置,每個韓文、日文、簡體中文和繁體中文輸入語言都有一個觸控優化的版面配置。In addition to the classic layouts, there is one touch-optimized layout for each of the Korean, Japanese, Simplified Chinese, and Traditional Chinese input languages.

若要使用此功能,您的 IME 必須執行 ITfFnGetPreferredTouchKeyboardLayout 介面,該介面是由 ime 使用文字服務架構 ITfFunctionProvider API 所匯出。To use this functionality, your IME must implement the ITfFnGetPreferredTouchKeyboardLayout interface, which is exported by the IME by using the Text Services Framework ITfFunctionProvider API.

如果您的輸入法不支援 ITfFnGetPreferredTouchKeyboardLayout 介面,則使用 IME 會產生觸控鍵盤所顯示之語言的預設傳統版面配置。If your IME doesn't support the ITfFnGetPreferredTouchKeyboardLayout interface, using the IME results in the default classic layout for the language that is displayed by the touch keyboard.

如果您的輸入法必須將其中一個傳統版面配置設定為慣用版面配置,則輸入端不需要任何額外的工作,超出支援 ITfFnGetPreferredTouchKeyboardLayout 和 ITfFunctionProvider 介面的範圍。If your IME needs to set one of the classic layouts as the preferred layout, no additional work is required on the IME side beyond supporting the ITfFnGetPreferredTouchKeyboardLayout and ITfFunctionProvider interfaces. 但是,輸入法需要額外的工作才能使用觸控優化的版面配置,而且下一節將說明這一點。But additional work is required in the IME to work with the touch-optimized layouts, and this is described in the next section.

觸控優化的版面配置Touch-optimized layout

適用于韓文、日文、簡體中文和繁體中文輸入語言的觸控優化鍵盤,會在轉換模式中顯示不同的輸入和 IME 版面配置。The touch-optimized keyboards for the Korean, Japanese, Simplified Chinese, and Traditional Chinese input languages display a different layout for IME On and IME Off conversion modes. 觸控鍵盤上有一個按鍵,可將 IME 轉換模式設定為 [開啟] 或 [關閉],但鍵盤的 IME 模式也可能隨著編輯控制項之間的焦點變更而變更。There's a key on the touch keyboard to set the IME conversion mode to On or Off, but the IME mode of the keyboard also may change as focus changes among edit controls.

日文、簡體中文和繁體中文輸入語言的觸控優化鍵盤包含一個按鍵,也就是 IME 用來流覽候選頁面的按鍵。The touch-optimized keyboards for the Japanese, Simplified Chinese, and Traditional Chinese input languages contain a key, or keys, which the IME uses to navigate through candidate pages. 若為日文和簡體中文,候選頁面索引鍵會顯示在觸控優化的版面配置上。For Japanese and Simplified Chinese, the candidate page key displays on the touch-optimized layout. 若是繁體中文,則會有不同的金鑰用於上一頁和下一個候選頁面。For Traditional Chinese, there are separate keys for the previous and next candidate pages.

當按下這些按鍵時,觸控鍵盤會呼叫 SendInput 函式,將下列 Unicode 私用區域字元傳送給焦點應用程式,讓 IME 可以攔截並採取動作:When these keys are pressed, the touch keyboard calls the SendInput function to send the following Unicode Private Use Area characters to the focused application, which the IME can intercept and act on:

  • **下一頁 (0xF003) ** -當在日文和簡體中文的觸控優化鍵盤上按下候選頁面按鍵時,或在繁體中文的觸控優化鍵盤上按下一個頁面按鍵時傳送。Next page (0xF003) - Sent when the candidate page key is pressed on the touch-optimized keyboard for Japanese and Simplified Chinese, or when the next page key is pressed on the touch-optimized keyboard for Traditional Chinese.
  • **上一頁 (0xF004) ** -在按下候選頁面按鍵時傳送,以在日文和簡體中文的觸控優化鍵盤上同步選取 Shift 鍵,或在繁體中文觸控優化鍵盤上按下一個頁面按鍵時傳送。Previous page (0xF004) - Sent when either the candidate page key is pressed at the same time as the Shift key on the touch-optimized keyboard for Japanese and Simplified Chinese, or when the previous page key is pressed on the touch-optimized keyboard for Traditional Chinese.

這些字元會以 Unicode 輸入的形式傳送。These characters are sent as Unicode input. 下一段會詳細說明如何在文字服務架構 IME 將接收的重要事件接收通知期間解壓縮字元資訊。The next paragraph details how to extract the character information during the key event sink notifications that the Text Services Framework IME will receive. 這些字元值不會在任何標頭檔中定義,因此您必須在程式碼中定義它們。These character values are not defined in any header file, so you will need to define them in your code.

若要攔截鍵盤輸入,您的 IME 必須註冊為主要事件接收器。To intercept keyboard input, your IME must register as a key event sink. 針對使用 SendInput 函式所產生的 Unicode 輸入, ITfKeyEventSink 回呼的 WPARAM 參數 (OnKeyDown、OnKeyUp、OnTestKeyDown、OnTestKeyUp) 一律包含虛擬機器碼 VK_PACKET 且不會直接識別該字元。For Unicode input that is generated by using the SendInput function, the WPARAM parameter of the ITfKeyEventSink callbacks (OnKeyDown, OnKeyUp, OnTestKeyDown, OnTestKeyUp) always contains the virtual key VK_PACKET and doesn't identify the character directly.

執行下列呼叫順序來存取字元:Implement the following call sequence to access the character:

// Keyboard state
BYTE abKbdState[256];
if (!GetKeyboardState(abKbdState))
{
   return 0;
}

// Map virtual key to character code
WCHAR wch;
if (ToUnicode(VK_PACKET, 0, abKbdState, &wch, 1, 0) == 1)
{
   return wch;
}

IME 搜尋整合IME search integration

透過搜尋合約提供使用者搜尋功能,並與 [搜尋] 窗格整合。Provide users with search features through the search contract and integration with the search pane.

搜尋窗格和輸入法的建議
搜尋窗格和輸入法的建議Search pane and IME suggestions

搜尋窗格是一個中心位置,可讓使用者在其所有應用程式中執行搜尋。The search pane is a central location for users to perform searches across all of their apps. 針對 IME 使用者,Windows 提供獨特的搜尋體驗,可讓相容的 Ime 與 Windows 整合,以提高效率和可用性。For IME users, Windows provides a unique search experience that lets compatible IMEs integrate with Windows for greater efficiency and usability.

使用與搜尋相容的 IME 輸入的使用者,有兩個主要優點:Users who type with an IME that's compatible with search get two main benefits:

  • 輸入法與搜尋體驗之間的緊密互動。Seamless interaction between the IME and the search experience. IME 候選項目會以內嵌方式顯示在搜尋方塊下方,而不會遮蔽搜尋建議。IME candidates are shown inline under the search box without occluding search suggestions. 使用者可以使用鍵盤在搜尋方塊、IME 轉換候選項目和搜尋建議之間順暢地流覽。The user can use the keyboard to navigate seamlessly between the search box, the IME conversion candidates, and the search suggestions.
  • 更快速地存取應用程式所提供的相關結果和建議。Faster access to relevant results and suggestions provided by applications. 應用程式可存取所有目前的轉換候選項目,以提供更相關的建議。The app has access to all current conversion candidates to provide more relevant suggestions. 為了更妥善設定搜尋建議的優先順序,會以相關性的順序提供應用程式的轉換。To better prioritize search suggestions, conversions are given to apps in order of relevance. 使用者可以在不轉換的情況下尋找並選取所要的結果,只要輸入拼音就可以了。Users find and select the result they want without converting, just by typing in phonetic.

如果 IME 符合下列準則,則 IME 與整合式搜尋體驗相容:An IME is compatible with the integrated search experience if it meets the following criteria:

在 [搜尋] 窗格中啟用時,相容的 IME 會置於 UIless 模式,而且無法顯示其 UI。When activated in the search pane, a compatible IME is placed in UIless mode and can't show its UI. 相反地,它會將轉換候選項目傳送給 Windows,以將它們顯示在內嵌候選清單控制項中,如先前的螢幕擷取畫面所示。Instead, it sends conversion candidates to Windows, which displays them in the inline candidate list control, as shown in the previous screenshot.

此外,IME 也會傳送應用來執行目前搜尋的候選項目。Also, the IME sends candidates that should be used to run the current search. 這些候選項目可以與轉換候選項目相同,或可針對搜尋量身打造。These candidates could be the same as the conversion candidates, or they could be tailored for search.

良好的搜尋候選人符合下列準則:Good search candidates meet the following criteria:

  • 沒有前置詞重迭。No prefix overlap. 例如,北京大學 and北京是多餘的,因為它是另一個的前置詞。For example, 北京大学 and北京 are redundant because one is a prefix of the other.
  • 無多餘的候選項目。No redundant candidates. 任何多餘的候選項對搜尋都沒有説明,因為它不會協助篩選結果。Any redundant candidate isn't useful for search because it doesn't help filter results. 例如,任何符合北京大學的結果也會符合北京。For example, any result that matches 北京大学 also matches 北京.
  • 無預測候選,僅限轉換。No prediction candidate, only conversion. 例如,如果使用者輸入 "as",IME 可以傳回北做為候選項,但無法傳回北京大學。For example, if the user types "be", the IME can return 北 as a candidate, but not 北京大学. 預測候選項目通常太嚴格。Usually, prediction candidates are too restrictive.

不符合準則的 Ime 與其他控制項的方式相同,無法與搜尋顯示相容,而且無法利用 UI 整合和搜尋候選項目。IMEs that don't meet the criteria aren't compatible with search display in the same way as other controls, and can't take advantage of UI integration and search candidates. 應用程式只會在使用者完成撰寫之後才接收查詢。Apps receive queries only after the user has finished composing.

當支援搜尋合約的應用程式收到查詢時,查詢事件會包含 "queryTextAlternatives" 陣列,其中包含所有已知的替代方案,並根據最相關的 (可能) 最相關的 (不太) 。When an app that supports the search contract receives a query, the query event contains a "queryTextAlternatives" array that contains all known alternatives, ranked from the most relevant (likely) to least relevant (unlikely).

提供替代方案時,應用程式應該將每個替代方案視為查詢,並傳回符合任何替代專案的所有結果。When alternatives are provided, the app should treat each alternative as a query and return all results that match any of the alternatives. 應用程式的行為應該與使用者同時發出多個查詢相同,基本上是對提供結果的服務發出「或」查詢。The app should behave as if the user had issued multiple queries at the same time, essentially issuing an "or" query to the service providing the results. 基於效能考慮,應用程式通常會限制與最相關的替代專案5和20之間的相符專案。For performance considerations, apps often limit matching to between 5 and 20 of the most relevant alternatives.

UI 設計指導方針UI design guidelines

所有 Ime 都必須遵循 設計和程式碼 Windows 應用程式中所述的使用者經驗指導方針。All IMEs must follow the user experience guidelines described in Design and code Windows apps.

不要使用粘滯視窗Don't use sticky windows

您的 IME 視窗應該只在需要時才會出現,而且不應該隨時顯示。Your IME windows should appear only when needed, and they shouldn't be visible all the time. 當使用者不需要輸入時,就不應該顯示 IME。When users don't need to type, IME windows shouldn't show. IME 視窗不應該是全螢幕視窗。The IME window shouldn't be a full screen window. IME windows 不應彼此重迭。IME windows shouldn't overlap each other. Windows 應以 Windows 樣式來設計,並遵循 UI 縮放比例。The windows should be designed in a Windows style and follow UI scaling.

輸入法圖示IME icons

有兩種類型的 IME 圖示、商標圖示和模式圖示。There are two kinds of IME icons, branding icons and mode icons. 所有的輸入法圖示都必須僅使用黑色和白色色彩來設計。All IME icons must be designed with black and white colors only. 新的輸入法圖示借用系統匣圖示的 glyphic 外觀。The new IME icons borrow from the glyphic look of the system tray icons. 已建立此樣式,因此所有語言都可以使用它來補充 familial 外觀,同時也能彼此區分。This style has been created so all languages can use it to complement the familial look while also differentiating from each other.

輸入法圖示的檔案格式為 .ICO。The file format for IME icons is ICO. 您必須提供下列圖示大小。You must provide the following icon sizes.

  • 16x16 圖元16x16 pixels
  • 20x20 圖元20x20 pixels
  • 24x24 圖元24x24 pixels
  • 32x32 圖元32x32 pixels
  • 40x40 圖元40x40 pixels
  • 48x48 圖元48x48 pixels

確定已在所有解析度中提供具有 Alpha 通道的32點陣圖標。Ensure that 32-bit icons with alpha channel are provided in all resolutions.

IME 品牌圖示是由白色方塊所定義,其中會放置以新式字型轉譯的印刷樣式符號。IME brand icons are defined by a white box in which a typographic glyph rendered in a modern typeface is placed. 每個語言小組都會選擇每個定義圖像。Each defining glyph is chosen by each language team. 圖像是黑色。The glyph is black. 方塊中包含1圖元的外部筆劃(以50% 不透明度為黑色)。The box includes an outer stroke of 1 pixel in black at 50% opacity. 「新的」版本是由方塊左上角的圓角所定義。"New" versions are defined by a rounded corner in the upper left of the box.

IME 模式圖示是由新式字型中的白色印刷字元所定義,其中包含1圖元的外部筆劃(以50% 的不透明度為黑色)。IME mode icons are defined by a white typographic glyph in a modern typeface which includes an outer stroke of 1 pixel in black at 50% opacity.

圖示Icon 描述Description
繁體中文 ChangeJie 的範例 IME 品牌圖示。 繁體中文 ChangeJie 的範例 IME 品牌圖示。Example IME brand icon for Traditional Chinese ChangeJie.
繁體中文新 ChangeJie 的範例 IME 品牌圖示。 繁體中文 ChangeJie 的範例 IME 品牌圖示。Example IME brand icon for Traditional Chinese ChangeJie.
中文模式圖示 範例輸入法模式圖示。Example IME mode icon.

擁有的視窗Owned window

若要顯示候選的 UI,IME 必須將其視窗設定為所擁有的視窗,讓它可以顯示在目前正在執行的應用程式上。To display candidate UI, an IME must set its window to be owned-window, so it can display over the currently running app. 您可以使用 ITfCoNtextView:: GetWnd 方法來取出要擁有的視窗。Use the ITfContextView::GetWnd method to retrieve the window to own to. 如果 GetWnd 傳回錯誤或 NullHWND,請呼叫 GetFocus 函數。If GetWnd returns an error or a NULLHWND, call the GetFocus function.

if (FAILED(pView->GetWnd(&parentWndHandle)) || (parentWndHandle == nullptr)) { parentWndHandle = GetFocus(); }

與淺色關閉表面互動的 IME 候選視窗IME candidate window interaction with light dismiss surfaces

快顯視窗的關閉模型稱為「淺色關閉」,因為使用者很容易就能關閉這類視窗。The dismissal model for popup windows is called "light dismiss" because it's easy for a user to close such windows. 為了讓 Ime 在 Windows 互動模型中正常運作,IME windows 必須參與 light 解除模型。For IMEs to function well in the Windows interaction model, the IME windows must participate in the light dismiss model.

為了參與 light 解除模型,您的 IME 必須使用 NotifyWinEvent 函式或類似的函式,引發三個新的 Windows 事件。In order to participate in the light dismiss model, your IME must raise three new Windows events by using the NotifyWinEvent function or a similar function. 這些新事件包括:These new events are:

  • EVENT_OBJECT_IME_SHOW -當 IME 變成可見時引發這個事件。EVENT_OBJECT_IME_SHOW - Raise this event when the IME becomes visible.
  • EVENT_OBJECT_IME_HIDE -隱藏 IME 時引發這個事件。EVENT_OBJECT_IME_HIDE - Raise this event when the IME is hidden.
  • EVENT_OBJECT_IME_CHANGE -當 IME 移動或變更大小時,引發這個事件。EVENT_OBJECT_IME_CHANGE - Raise this event when the IME moves or changes size.

宣告相容性Declaring compatibility

Ime 宣告它們是相容的,其方式是使用 ITfCategoryMgr:: RegisterCategory註冊其 IME GUID_TFCAT_TIPCAP_IMMERSIVESUPPORT 的分類。IMEs declare that they are compatible by registering the category GUID_TFCAT_TIPCAP_IMMERSIVESUPPORT for their IME using ITfCategoryMgr::RegisterCategory.

將預設的 IME 模式設定為開啟Set the default IME mode to on

我們為 Ime 提供了更好的 UX。We provide a better UX for IMEs.

桌面應用程式的 DPI 縮放比例支援DPI scaling support for desktop applications

增強的 DPI 縮放支援可讓您查詢每個桌面進程的宣告 DPI 感知層級,以判斷是否需要調整 UI 規模。Enhanced DPI scaling support enables querying the declared DPI awareness level of each desktop process to determine if it needs to scale the UI. 在多重監視器案例中,Windows 會在每個監視器上適當地調整 UI 以進行不同的 DPI 設定。In a multi-monitor scenario, Windows scales the UI appropriately for different DPI settings on each monitor.

由於您的 IME 是在每個應用程式的程式內容中執行,因此您不應該為 IME 宣告 DPI 感知層級。Because your IME runs in the context of each application's process, you shouldn't declare a DPI awareness level for your IME. 這可確保您的 IME 在目前進程的 DPI 感知層級執行。This ensures that your IME runs at the DPI awareness level of the current process.

為了確保所有 IME UI 元素都與您正在執行之進程的 UI 元素有所調整,您必須適當地回應不同的 DPI 值。To ensure that all IME UI elements have scaling parity with the UI elements of the process in which you are running, you must respond appropriately to different DPI values.

注意

為了確保與新的桌面應用程式具有相同的功能,您的 IME 應該支援每個監視器– DPI 感知,但不應宣告某種程度的認知本身。To ensure parity with new desktop applications, your IME should support per monitor–DPI awareness, but shouldn't declare a level of awareness itself. 系統會在每個案例中決定適當的調整需求。The system determines the appropriate scaling requirements in each scenario.

如需桌面應用程式的 DPI 縮放支援需求的詳細資訊,請參閱 高 DPIFor details about DPI scaling support requirements for Desktop applications, see High DPI.

輸入法安裝IME installation

如果您使用 Microsoft Visual Studio 建立您的輸入法,請使用協力廠商安裝程式(例如從 >flexera Software InstallShield)為您的 IME 建立安裝體驗。If you build your IME by using Microsoft Visual Studio, create an installation experience for your IME by using a third-party installer, like InstallShield from Flexera Software.

下列步驟顯示如何使用 InstallShield 來為您的 IME DLL 建立安裝專案。The following steps show how to use InstallShield to create a setup project for your IME DLL.

  • 安裝 Visual Studio。Install Visual Studio.
  • 啟動 Visual Studio。Start Visual Studio.
  • 在 [檔案] 功能表上,指向 [新增],然後選取 [專案]。On the File menu, point to New and select Project. [ 新增專案 ] 對話方塊隨即開啟。The New Project dialog opens.
  • 在左窗格中,流覽至 [ 範本 > 其他專案類型] > 安裝和部署],按一下 [ 啟用 InstallShield 限量版],然後按一下 [確定]In the left pane, navigate to Templates > Other Project Types > Setup and Deployment, click Enable InstallShield Limited Edition, and click OK. 遵循安裝指示進行。Follow the installation instructions.
  • 重新啟動 Visual Studio。Restart Visual Studio.
  • ( .sln) 檔案中開啟 IME 方案。Open the IME solution (.sln) file.
  • 在方案總管中,以滑鼠右鍵按一下方案,指向 [ 加入],然後選取 [ 新增專案]。In Solution Explorer, right-click the solution, point to Add, and select New Project. [ 加入新專案 ] 對話方塊隨即開啟。The Add New Project dialog opens.
  • 在左側樹狀檢視控制項中,流覽至 [ 範本 > 其他專案類型] > [InstallShield 限量版]。In the left tree view control, navigate to Templates > Other Project Types > InstallShield Limited Edition.
  • 在中央視窗中,按一下 [ InstallShield 限量版專案]。In the center window, click InstallShield Limited Edition Project.
  • 在 [ 名稱 ] 文字方塊中,輸入 "SetupIME",然後按一下 [確定]In the Name text box, type "SetupIME" and click OK.
  • 在 [ 專案助理 ] 對話方塊中,按一下 [ 應用程式資訊]。In the Project Assistant dialog, click Application Information.
  • 填寫您的公司名稱和其他欄位。Fill in your company name and the other fields.
  • 按一下 [ 應用程式檔]。Click Application Files.
  • 在左窗格中,以滑鼠右鍵按一下 [INSTALLDIR] 資料夾,然後選取 [ 新增資料夾]。In the left pane, right-click the [INSTALLDIR] folder, and select New Folder. 將資料夾命名為 "外掛程式"。Name the folder "Plugins".
  • 按一下 [ 新增檔案]。Click Add Files. 流覽至您的 IME DLL,然後將它新增至 [ 外掛程式 ] 資料夾。Navigate to your IME DLL and add it to the Plugins folder. 針對 IME 字典重複此步驟。Repeat this step for the IME dictionary.
  • 以滑鼠右鍵按一下 IME DLL,然後選取 [ 屬性]。Right-click the IME DLL and select Properties. [ 屬性 ] 對話方塊隨即開啟。The Properties dialog opens.
  • 在 [ 屬性 ] 對話方塊中,按一下 [ COM & .net 設定 ] 索引標籤。In the Properties dialog, click the COM & .NET Settings tab.
  • 在 [ 註冊類型] 下,選取 [ 自我註冊 ],然後按一下 [確定]Under Registration Type, select Self-registration and click OK.
  • 建置方案。Build the solution. IME DLL 是建立的,InstallShield 會建立一個 setup.exe 檔案,讓使用者可以在 Windows 上安裝您的 IME。The IME DLL is built, and InstallShield creates a setup.exe file that enables users to install your IME on Windows.

若要建立您自己的安裝體驗,請在安裝期間呼叫 ITfInputProcessorProfileMgr:: RegisterProfile 方法來註冊 IME。To create your own installation experience, call the ITfInputProcessorProfileMgr::RegisterProfile method to register the IME during installation. 請勿直接寫入登錄專案。Don't write registry entries directly.

如果 IME 必須在安裝後立即可供使用,請呼叫 InstallLayoutOrTip 將輸入法新增至使用者啟用的輸入方法,並針對 psz 參數使用下列格式:If the IME must be usable immediately after installation, call InstallLayoutOrTip to add the IME to user-enabled input methods, using the following format for the psz parameter:

<LangID 1>:{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}

IME 協助工具IME accessibility

執行下列慣例,讓您的 Ime 符合協助工具需求,以及使用朗讀程式。Implement the following convention to make your IMEs conform to the accessibility requirements and to work with Narrator. 若要讓候選清單成為可存取的,您的 Ime 必須遵循此慣例。To make candidate lists accessible, your IMEs must follow this convention.

  • 候選清單的 UIA_AutomationIdPropertyId 必須等於「IME_Candidate_Window」,才能取得轉換候選清單或「IME_Prediction_Window」以取得預測候選清單。The candidate list must have a UIA_AutomationIdPropertyId equal to "IME_Candidate_Window" for lists of conversion candidates or "IME_Prediction_Window" for lists of prediction candidates.
  • 當候選清單出現並消失時,會分別引發 UIA_MenuOpenedEventIdUIA_MenuClosedEventId類型的事件When the candidate list appears and disappears, it raises events of type UIA_MenuOpenedEventId and UIA_MenuClosedEventId, respectively
  • 當目前選取的候選項變更時,候選清單會引發 UIA_SelectionItem_ElementSelectedEventIdWhen the current selected candidate changes, the candidate list raises a UIA_SelectionItem_ElementSelectedEventId. 選取的元素應該有屬性 UIA_SelectionItemIsSelectedPropertyId 等於 TRUEThe selected element should have a property UIA_SelectionItemIsSelectedPropertyId equal to TRUE.
  • 候選清單中每個專案的 UIA_NamePropertyId 都必須是候選項目的名稱。The UIA_NamePropertyId for each item in the candidate list must be the name of the candidate. (選擇性)您可以提供其他資訊,透過 UIA_HelpTextPropertyId來區分候選項目。Optionally, you can provide additional information to disambiguate candidates through UIA_HelpTextPropertyId.