Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Package Functions | List of all members
io.flutter.embedding.android.KeyboardManager.CharacterCombiner Class Reference

Public Member Functions

 CharacterCombiner ()
 

Package Functions

Character applyCombiningCharacterToBaseCharacter (int newCharacterCodePoint)
 

Detailed Description

Applies the given Unicode character from KeyEvent#getUnicodeChar() to a previously entered Unicode combining character and returns the combination of these characters if a combination exists.

This class is not used by KeyboardManager, but by its responders.

Definition at line 56 of file KeyboardManager.java.

Constructor & Destructor Documentation

◆ CharacterCombiner()

io.flutter.embedding.android.KeyboardManager.CharacterCombiner.CharacterCombiner ( )
inline

Definition at line 59 of file KeyboardManager.java.

59{}

Member Function Documentation

◆ applyCombiningCharacterToBaseCharacter()

Character io.flutter.embedding.android.KeyboardManager.CharacterCombiner.applyCombiningCharacterToBaseCharacter ( int  newCharacterCodePoint)
inlinepackage

This method mutates combiningCharacter over time to combine characters.

One of the following things happens in this method:

  • If no previous combiningCharacter exists and the newCharacterCodePoint is not a combining character, then newCharacterCodePoint is returned.
  • If no previous combiningCharacter exists and the newCharacterCodePoint is a combining character, then newCharacterCodePoint is saved as the combiningCharacter and null is returned.
  • If a previous combiningCharacter exists and the newCharacterCodePoint is also a combining character, then the newCharacterCodePoint is combined with the existing combiningCharacter and null is returned.
  • If a previous combiningCharacter exists and the newCharacterCodePoint is not a combining character, then the combiningCharacter is applied to the regular newCharacterCodePoint and the resulting complex character is returned. The combiningCharacter is cleared.

The following reference explains the concept of a "combining character": https://en.wikipedia.org/wiki/Combining_character

Definition at line 84 of file KeyboardManager.java.

84 {
85 char complexCharacter = (char) newCharacterCodePoint;
86 boolean isNewCodePointACombiningCharacter =
87 (newCharacterCodePoint & KeyCharacterMap.COMBINING_ACCENT) != 0;
88 if (isNewCodePointACombiningCharacter) {
89 // If a combining character was entered before, combine this one with that one.
90 int plainCodePoint = newCharacterCodePoint & KeyCharacterMap.COMBINING_ACCENT_MASK;
91 if (combiningCharacter != 0) {
92 combiningCharacter = KeyCharacterMap.getDeadChar(combiningCharacter, plainCodePoint);
93 } else {
94 combiningCharacter = plainCodePoint;
95 }
96 } else {
97 // The new character is a regular character. Apply combiningCharacter to it, if
98 // it exists.
99 if (combiningCharacter != 0) {
100 int combinedChar = KeyCharacterMap.getDeadChar(combiningCharacter, newCharacterCodePoint);
101 if (combinedChar > 0) {
102 complexCharacter = (char) combinedChar;
103 }
104 combiningCharacter = 0;
105 }
106 }
107
108 return complexCharacter;
109 }

The documentation for this class was generated from the following file: