Wiki Page Content

Differences between revisions 6 and 7
Revision 6 as of 2010-08-22 01:53:23
Size: 3540
Editor: DanielWyatt
Comment: null
Revision 7 as of 2010-08-22 22:52:31
Size: 3534
Editor: DanielWyatt
Comment: null
Deletions are marked like this. Additions are marked like this.
Line 19: Line 19:
 * <<Anchor(CandidateList)>>'''Candidate List''' - A list of Candidates, used when there is any ambiguity.  * <<Anchor(CandidateList)>>'''Candidate List''' - A list of [[#Candidate|Candidate]]s, used when there is any ambiguity.
Line 22: Line 22:
||<style="width: 10%">Step||<style="width: 60%">Description||<style="width: 30%">Example||
||1||The user activates an input method ([[#IME|IME]]). This is typically done via a hotkey or by selecting an input method in a GUI.||<style="text-align: right;">[[attachment:TextInput1.png|{{attachment:TextInput1.png|TextInput1|width=150}}|target="_blank"]]||
||2||The user begins to type in their selected language, starting a [[#Composition|Composition]].||<style="text-align: right;">[[attachment:TextInput2.png|{{attachment:TextInput2.png|TextInput2|width=150}}|target="_blank"]]||
||3||The user continued typing until the composition is satisfactory.||<style="
text-align: right;">[[attachment:TextInput3.png|{{attachment:TextInput3.png|TextInput3|width=150}}|target="_blank"]]||
||4||Alternatively, the user may choose to open the [[#CandidateList|Candidate List]] and select a [[#Candidate|Candidate]].||<style="text-align: right;">[[attachment:TextInput4.png|{{attachment:TextInput4.png|TextInput4|width=150}}|target="_blank"]]||
||5||The user commits the [[#Composition|Composition]], terminating it. The [[#IME|IME]] passes the text onto the application.||<style="text-align: right;">[[attachment:TextInput5.png|{{attachment:TextInput5.png|TextInput5|width=150}}|target="_blank"]]||
||<10%>Step ||<60%>Description ||<30%>Example ||
||1 ||The user activates an input method ([[#IME|IME]]). This is typically done via a hotkey or by selecting an input method in a GUI. ||<style="text-align: right">[[attachment:TextInput1.png|{{attachment:TextInput1.png|TextInput1|width="150"}}]] ||
||2 ||The user begins to type in their selected language, starting a [[#Composition|Composition]]. ||<style="text-align: right">[[attachment:TextInput2.png|{{attachment:TextInput2.png|TextInput2|width="150"}}]] ||
||3 ||The user continued typing until the composition is satisfactory. ||<style
="text-align: right">[[attachment:TextInput3.png|{{attachment:TextInput3.png|TextInput3|width="150"}}]] ||
||4 ||Alternatively, the user may choose to open the [[#CandidateList|Candidate List]] and select a [[#Candidate|Candidate]]. The [[#IME|IME]] can also force the [[#CandidateList|Candidate List]] to open. ||<style="text-align: right">[[attachment:TextInput4.png|{{attachment:TextInput4.png|TextInput4|width="150"}}]] ||
||5 ||The user commits the [[#Composition|Composition]], terminating it. The [[#IME|IME]] passes the text onto the application. ||<style="text-align: right">[[attachment:TextInput5.png|{{attachment:TextInput5.png|TextInput5|width="150"}}]] ||

Text Input

Why?

Why does SDL need a text input API?

When I press a key on my keyboard, my program receives a character event, right?

Well, it's not always that simple. Sometimes it can take multiple key presses to produce a character. Sometimes a single key press can produce multiple characters.

Text input is not as simple as it seems, particularly when you consider International users (and you should). It's not hard to figure out why that is when you look at languages like Chinese, Japanese, and Korean. These languages, collectively referred to as the CJK, have thousands of symbols.

It would not be feasible to have a keyboard with over ten-thousand keys, would it? The solution to this is a software input method.

Terms

  • IME - Input Method Editor. A software input method. This is typically a program that intercepts key presses and interprets them before (eventually) passing them onto the application.

  • Composition - The text a user is currently inputting. This text is not yet finalized (committed) and the IME may modify it.

  • Candidate - An optional alternative text for the composition, gathered by the IME in the Candidate List.

  • Candidate List - A list of Candidates, used when there is any ambiguity.

Workflow

Step

Description

Example

1

The user activates an input method (IME). This is typically done via a hotkey or by selecting an input method in a GUI.

TextInput1

2

The user begins to type in their selected language, starting a Composition.

TextInput2

3

The user continued typing until the composition is satisfactory.

TextInput3

4

Alternatively, the user may choose to open the Candidate List and select a Candidate. The IME can also force the Candidate List to open.

TextInput4

5

The user commits the Composition, terminating it. The IME passes the text onto the application.

TextInput5

While this provides a good overview, it may not be accurate for all platforms.

There are multiple input method styles which you can read about here. SDL supports "on-the-spot" mode. This has an important implication: the application is responsible for drawing the composition.

SDL

So how does SDL handle text input?

Functions

Events

One important thing to notice is that the application can enable and disable text input arbitrarily with SDL_StartTextInput and SDL_StopTextInput. SDL_SetTextInputRect controls where the Candidate List will open, if supported.

None: Tutorials/TextInput (last edited 2020-06-20 12:07:24 by SylvainBeucler)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit