[SD12] Add the last remaining scripts

Add scripts for Bengali, Devanagari, Kannada, Malayalam,
and Tamil.
Also include a very minor fix for Arabic.

This concludes work on:
Bug: 15840116

Change-Id: Iade313fc70030a67c68d424d8cb0cac245b883d1
main
Jean Chalard 2014-07-30 13:01:44 +09:00
parent 7c5cd5ec89
commit 3a729d4ed8
11 changed files with 45 additions and 2 deletions

View File

@ -494,6 +494,11 @@
<enum name="sinhala" value="10" /> <enum name="sinhala" value="10" />
<enum name="thai" value="11" /> <enum name="thai" value="11" />
<enum name="telugu" value="12" /> <enum name="telugu" value="12" />
<enum name="devanagari" value="13" />
<enum name="bengali" value="14" />
<enum name="tamil" value="15" />
<enum name="kannada" value="16" />
<enum name="malayalam" value="17" />
</attr> </attr>
</declare-styleable> </declare-styleable>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -39,6 +39,11 @@ public class ScriptUtils {
public static final int SCRIPT_SINHALA = 10; public static final int SCRIPT_SINHALA = 10;
public static final int SCRIPT_THAI = 11; public static final int SCRIPT_THAI = 11;
public static final int SCRIPT_TELUGU = 12; public static final int SCRIPT_TELUGU = 12;
public static final int SCRIPT_DEVANAGARI = 13;
public static final int SCRIPT_BENGALI = 14;
public static final int SCRIPT_TAMIL = 15;
public static final int SCRIPT_KANNADA = 16;
public static final int SCRIPT_MALAYALAM = 17;
public static final TreeMap<String, Integer> mSpellCheckerLanguageToScript; public static final TreeMap<String, Integer> mSpellCheckerLanguageToScript;
static { static {
// List of the supported languages and their associated script. We won't check // List of the supported languages and their associated script. We won't check
@ -102,12 +107,12 @@ public class ScriptUtils {
case SCRIPT_ARABIC: case SCRIPT_ARABIC:
// Arabic letters can be in any of the following blocks: // Arabic letters can be in any of the following blocks:
// Arabic U+0600..U+06FF // Arabic U+0600..U+06FF
// Arabic Supplement U+0750..U+077F // Arabic Supplement, Thaana U+0750..U+077F, U+0780..U+07BF
// Arabic Extended-A U+08A0..U+08FF // Arabic Extended-A U+08A0..U+08FF
// Arabic Presentation Forms-A U+FB50..U+FDFF // Arabic Presentation Forms-A U+FB50..U+FDFF
// Arabic Presentation Forms-B U+FE70..U+FEFF // Arabic Presentation Forms-B U+FE70..U+FEFF
return (codePoint >= 0x600 && codePoint <= 0x6FF) return (codePoint >= 0x600 && codePoint <= 0x6FF)
|| (codePoint >= 0x750 && codePoint <= 0x77F) || (codePoint >= 0x750 && codePoint <= 0x7BF)
|| (codePoint >= 0x8A0 && codePoint <= 0x8FF) || (codePoint >= 0x8A0 && codePoint <= 0x8FF)
|| (codePoint >= 0xFB50 && codePoint <= 0xFDFF) || (codePoint >= 0xFB50 && codePoint <= 0xFDFF)
|| (codePoint >= 0xFE70 && codePoint <= 0xFEFF); || (codePoint >= 0xFE70 && codePoint <= 0xFEFF);
@ -153,6 +158,21 @@ public class ScriptUtils {
case SCRIPT_TELUGU: case SCRIPT_TELUGU:
// Telugu unicode block is U+0C00..U+0C7F // Telugu unicode block is U+0C00..U+0C7F
return (codePoint >= 0xC00 && codePoint <= 0xC7F); return (codePoint >= 0xC00 && codePoint <= 0xC7F);
case SCRIPT_DEVANAGARI:
// Devanagari unicode block is +0900..U+097F
return (codePoint >= 0x900 && codePoint <= 0x97F);
case SCRIPT_BENGALI:
// Bengali unicode block is U+0980..U+09FF
return (codePoint >= 0x980 && codePoint <= 0x9FF);
case SCRIPT_TAMIL:
// Tamil unicode block is U+0B80..U+0BFF
return (codePoint >= 0xB80 && codePoint <= 0xBFF);
case SCRIPT_KANNADA:
// Kannada unicode block is U+0C80..U+0CFF
return (codePoint >= 0xC80 && codePoint <= 0xCFF);
case SCRIPT_MALAYALAM:
// Malayalam unicode block is U+0D00..U+0D7F
return (codePoint >= 0xD00 && codePoint <= 0xD7F);
case SCRIPT_UNKNOWN: case SCRIPT_UNKNOWN:
return true; return true;
default: default: