Add Japanese dakuten and handakuten

This commit is contained in:
Jules Aguillon 2024-09-10 21:41:09 +02:00
parent 8339a1b480
commit 49944a743e
5 changed files with 69 additions and 2 deletions

44
srcs/compose/dakuten.json Normal file
View File

@ -0,0 +1,44 @@
{
"う": "ゔ",
"か": "が",
"き": "ぎ",
"く": "ぐ",
"け": "げ",
"こ": "ご",
"さ": "ざ",
"し": "じ",
"す": "ず",
"せ": "ぜ",
"そ": "ぞ",
"た": "だ",
"ち": "ぢ",
"つ": "づ",
"て": "で",
"と": "ど",
"は": "ば",
"ひ": "び",
"ふ": "ぶ",
"へ": "べ",
"ほ": "ぼ",
"ウ": "ヴ",
"カ": "ガ",
"キ": "ギ",
"ク": "グ",
"ケ": "ゲ",
"コ": "ゴ",
"サ": "ザ",
"シ": "ジ",
"ス": "ズ",
"セ": "ゼ",
"ソ": "ゾ",
"タ": "ダ",
"チ": "ヂ",
"ツ": "ヅ",
"テ": "デ",
"ト": "ド",
"ハ": "バ",
"ヒ": "ビ",
"フ": "ブ",
"ヘ": "ベ",
"ホ": "ボ"
}

View File

@ -0,0 +1,12 @@
{
"は": "ぱ",
"ひ": "ぴ",
"ふ": "ぷ",
"へ": "ぺ",
"ほ": "ぽ",
"ハ": "パ",
"ヒ": "ピ",
"フ": "プ",
"ヘ": "ペ",
"ホ": "ポ"
}

View File

@ -81,6 +81,8 @@ public final class KeyModifier
case HORN: return apply_compose(k, ComposeKeyData.accent_horn);
case HOOK_ABOVE: return apply_compose(k, ComposeKeyData.accent_hook_above);
case ARROW_RIGHT: return apply_map_char(k, map_char_arrow_right);
case DAKUTEN: return apply_compose(k, ComposeKeyData.dakuten);
case HANDAKUTEN: return apply_compose(k, ComposeKeyData.handakuten);
default: return k;
}
}

View File

@ -44,6 +44,8 @@ public final class KeyValue implements Comparable<KeyValue>
TREMA,
HORN,
HOOK_ABOVE,
DAKUTEN,
HANDAKUTEN,
SUPERSCRIPT,
SUBSCRIPT,
RING,
@ -298,10 +300,15 @@ public final class KeyValue implements Comparable<KeyValue>
return modifierKey(String.valueOf((char)symbol), m, flags | FLAG_KEY_FONT);
}
private static KeyValue diacritic(String symbol, Modifier m, int flags)
{
return new KeyValue(symbol, Kind.Modifier, m.ordinal(),
FLAG_LATCH | FLAG_SPECIAL | flags);
}
private static KeyValue diacritic(int symbol, Modifier m)
{
return new KeyValue(String.valueOf((char)symbol), Kind.Modifier, m.ordinal(),
FLAG_LATCH | FLAG_SPECIAL | FLAG_KEY_FONT);
return diacritic(String.valueOf((char)symbol), m, FLAG_KEY_FONT);
}
private static KeyValue eventKey(String symbol, Event e, int flags)
@ -448,6 +455,8 @@ public final class KeyValue implements Comparable<KeyValue>
case "accent_dot_below": return diacritic(0xE060, Modifier.DOT_BELOW);
case "accent_horn": return diacritic(0xE061, Modifier.HORN);
case "accent_hook_above": return diacritic(0xE062, Modifier.HOOK_ABOVE);
case "dakuten": return diacritic("", Modifier.DAKUTEN, 0);
case "handakuten": return diacritic("", Modifier.HANDAKUTEN, 0);
case "superscript": return modifierKey("Sup", Modifier.SUPERSCRIPT, 0);
case "subscript": return modifierKey("Sub", Modifier.SUBSCRIPT, 0);
case "ordinal": return modifierKey("Ord", Modifier.ORDINAL, 0);