[SD10] Add script checks for Lao and Khmer

Bug: 15840116
Change-Id: Id72b739e73cb3e72f56e1872ad9d60469555e193
Jean Chalard 2014-07-30 12:01:53 +09:00
parent c4f6fc1e48
commit a9c12692ed
4 changed files with 16 additions and 0 deletions

View File

@ -488,6 +488,8 @@
<enum name="hebrew" value="4" />
<enum name="armenian" value="5" />
<enum name="georgian" value="6" />
<enum name="khmer" value="7" />
<enum name="lao" value="8" />
</attr>
</declare-styleable>

View File

@ -20,6 +20,8 @@
<KeyboardLayoutSet
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
<Feature
latin:supportedScript="khmer" />
<Element
latin:elementName="alphabet"
latin:elementKeyboard="@xml/kbd_khmer"

View File

@ -20,6 +20,8 @@
<KeyboardLayoutSet
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
<Feature
latin:supportedScript="lao" />
<Element
latin:elementName="alphabet"
latin:elementKeyboard="@xml/kbd_lao"

View File

@ -33,6 +33,8 @@ public class ScriptUtils {
public static final int SCRIPT_HEBREW = 4;
public static final int SCRIPT_ARMENIAN = 5;
public static final int SCRIPT_GEORGIAN = 6;
public static final int SCRIPT_KHMER = 7;
public static final int SCRIPT_LAO = 8;
public static final TreeMap<String, Integer> mSpellCheckerLanguageToScript;
static {
// List of the supported languages and their associated script. We won't check
@ -122,6 +124,14 @@ public class ScriptUtils {
// or Georgian supplement block, U+2D00..U+2D2F
return (codePoint >= 0x10A0 && codePoint <= 0x10FF
|| codePoint >= 0x2D00 && codePoint <= 0x2D2F);
case SCRIPT_KHMER:
// Khmer letters are in unicode block U+1780..U+17FF, and the Khmer symbols block
// is U+19E0..U+19FF
return (codePoint >= 0x1780 && codePoint <= 0x17FF
|| codePoint >= 0x19E0 && codePoint <= 0x19FF);
case SCRIPT_LAO:
// The Lao block is U+0E80..U+0EFF
return (codePoint >= 0xE80 && codePoint <= 0xEFF);
case SCRIPT_UNKNOWN:
return true;
default: