Hi @MSDN_userSince1994_newaccount2023 ,
Thanks for your detailed questions!
After digging around, I agree with you that most "how to type Japanese" guides don't expose enough detail. Here's what I managed to find regarding your questions:
Is there official documentation for the IME’s internal logic?
I don't think so since Microsoft does not publish the internal IME logic model. The official documentation focuses on APIs. This is probably by design, IME state is exposed through documented flags and compartments rather than a public state machine.
There is a discussion regarding this, you can check it out if it relates to your current course of action that was last updated last year:
Disclaimer: This link is not Microsoft official documentation but it is trusted for information. Do not click or download any strange links that you might encounter.
What and how many logic states can the IME be in? Are there additional states?
According to IME Conversion Mode Values, conversion flags include:
- Hiragana (full-width)
- Katakana (full-width and half-width)
- Alphanumeric (full-width and half-width)
- Romaji input (
IME_CMODE_ROMAN) - Full-shape vs half-shape (
IME_CMODE_FULLSHAPE) - Conversion on/off (
IME_CMODE_NOCONVERSION)
Is there half-width Hiragana?
No. The official IME modes list does not include half-width Hiragana. Supported modes are Hiragana (full-width), Katakana (full/half-width), and Alphanumeric (full/half-width).
Reference: Japanese IME Guide.
Are there caps lock states for Katakana or Hiragana?
No. Caps Lock is a keyboard state, not an IME state. The IME does not have a separate “Caps Lock” mode for Katakana or Hiragana.
The only related IME flag is IME_CMODE_ROMAN (or TF_CONVERSIONMODE_ROMAN in TSF), which controls whether Romaji input is used for kana conversion. This is independent of the physical Caps Lock key.
IME Conversion Mode Values lists all IME flags. There is no Caps Lock flag, confirming it’s not part of IME state.
Flags for Conversion Mode (TSF) mirrors IMM32 flags and also lacks any Caps Lock state.
Do the Romaji modes remember the latest non-Romaji mode? Do the non-Romaji modes remember the Romaji caps lock bit?
From my understanding, there is no global memory for these modes. IME state is stored per input context:
- In IMM32, the state is tied to the
HIMC(input context) for the window. - In TSF, the state is stored in compartments like
GUID_COMPARTMENT_KEYBOARD_INPUTMODE_CONVERSION, which belong to the thread manager or document.
TSF Compartments explains that IME state is stored in compartments tied to a thread or document, not globally.
ImmGetConversionStatus shows how IMM32 retrieves conversion state for a specific input context, proving it’s context-based.
This means:
- If you switch between Romaji and Kana in the same text context, the IME may restore the previous mode but this is not guaranteed across apps.
- The Romaji flag and Caps Lock are unrelated. The IME does not store a “Caps Lock bit” for Romaji mode.
Is there a flag for “subject to conversion”?
Yes. IME_CMODE_NOCONVERSION (IMM32) and TF_CONVERSIONMODE_NOCONVERSION (TSF) indicate direct input without conversion. Combine this with IME open/close state to know if characters will be converted.
Why does behavior differ between apps like Notepad and Visual Studio?
I believe some apps use IMM32 (legacy) and others use TSF (modern). TSF tracks state per context and allows custom composition UIs, so mode-switching keys can behave differently. So this might be expected.
You can read it more here: Text Services Framework Overview.
I hope this clarifies your questions! If you still have any questions, please feel free to leave a comment. I'll be happy to help!