Page MenuHome

macOS: support Japanese input for text buttons
ClosedPublic

Authored by Yuki Hashimoto (hzuika) on Jun 24 2021, 10:03 PM.

Details

Summary

(I am not used to English expressions, so please forgive me if I am impolite.)

This patch is part of T51283.

This patch includes protocol updates (D11407) and code cleanup (D11434).
Applying them first will make this patch a little easier to read.

Problem
Blender dit not support to input East Asian characters (Chinese, Japanese, Korean) on Mac.
This patch supports Japanese input.

Solution
I implemented the appropriate processing in the methods of NSTextInputClient Protocol.

Old:

Current Patch:

Final (include Chinese and Korean support):

Note:
This patch does not include the following three fixes.

  1. Support Chinese and Korean input (D11699)
  2. Fixed to draw the position of the candidate window below the input text. (D11696, D11697)
  3. Fix to remove redundant rendering of input characters when typing from between the strings (D11072)

1
Since additional code is required, these implementations will be submitted as separate patches.

2 & 3
Since the source code in /source/blender/ will be changed, I will submit it as a separate patch, considering the influence on Windows.

Technical Note:
This section explains Japanese input.
For Japanese input, when the input method is enabled,

  1. type the alphabet,
  2. press the Space key to select the desired string from the conversion candidate window
  3. press the Enter key to confirm.
  • The conversion candidate window is drawn by the input method program calling firstRectForCharacterRange.
  • The string before confirmation (called composite in blender) is handled in the setMarkedText method called by the input method program.
  • The string after confirmation (called result in the blender) is processed in the insertText method called by the input method program.

Diff Detail

Repository
rB Blender

Event Timeline

Yuki Hashimoto (hzuika) requested review of this revision.Jun 24 2021, 10:03 PM
Yuki Hashimoto (hzuika) created this revision.

I've included some unnecessary files, so I'll fix them.

Fix: Removed unnecessary files.

Yuki Hashimoto (hzuika) edited the summary of this revision. (Show Details)Jun 25 2021, 1:04 AM

macOS: Remove redundant calculation

This calculation is moved to wm_widnow_IME_begin in wm_window.c

I'm sorry, but I made the same mistake again.

fix: Delete unnecessary files.

I couldn't figure out why arcanist was inserting unnecessary files.
Now that I found an option for preview, I'll use arc diff --only to check it beforehand.
I apologize for the inconvenience.

Thanks a lot for this and the other IME patches! It seems to be working well here.

I will do some code style and naming changes for consistency. I'll also use std::string to simplify memory allocation.

This revision is now accepted and ready to land.Jul 5 2021, 4:33 PM