use harfrust::{script, Direction, Script};
use static_lang_word_lists::WordList;
pub(crate) fn get_wordlist(script: &str) -> Option<&WordList> {
let wl = match script {
"Adlam" => &static_lang_word_lists::DIFFENATOR_ADLAM,
"Arabic" => &static_lang_word_lists::DIFFENATOR_ARABIC,
"Armenian" => &static_lang_word_lists::DIFFENATOR_ARMENIAN,
"Avestan" => &static_lang_word_lists::DIFFENATOR_AVESTAN,
"Bengali" => &static_lang_word_lists::DIFFENATOR_BENGALI,
"Bopomofo" => &static_lang_word_lists::DIFFENATOR_BOPOMOFO,
"Canadian_Aboriginal" => &static_lang_word_lists::DIFFENATOR_CANADIAN_ABORIGINAL,
"Chakma" => &static_lang_word_lists::DIFFENATOR_CHAKMA,
"Cherokee" => &static_lang_word_lists::DIFFENATOR_CHEROKEE,
"Common" => &static_lang_word_lists::DIFFENATOR_COMMON,
"Cyrillic" => &static_lang_word_lists::DIFFENATOR_CYRILLIC,
"Devanagari" => &static_lang_word_lists::DIFFENATOR_DEVANAGARI,
"Ethiopic" => &static_lang_word_lists::DIFFENATOR_ETHIOPIC,
"Georgian" => &static_lang_word_lists::DIFFENATOR_GEORGIAN,
"Greek" => &static_lang_word_lists::DIFFENATOR_GREEK,
"Gujarati" => &static_lang_word_lists::DIFFENATOR_GUJARATI,
"Gurmukhi" => &static_lang_word_lists::DIFFENATOR_GURMUKHI,
"Hebrew" => &static_lang_word_lists::DIFFENATOR_HEBREW,
"Hiragana" => &static_lang_word_lists::DIFFENATOR_HIRAGANA,
"Japanese" => &static_lang_word_lists::DIFFENATOR_JAPANESE,
"Katakana" => &static_lang_word_lists::DIFFENATOR_KATAKANA,
"Khmer" => &static_lang_word_lists::DIFFENATOR_KHMER,
"Lao" => &static_lang_word_lists::DIFFENATOR_LAO,
"Latin" => &static_lang_word_lists::DIFFENATOR_LATIN,
"Lisu" => &static_lang_word_lists::DIFFENATOR_LISU,
"Malayalam" => &static_lang_word_lists::DIFFENATOR_MALAYALAM,
"Mongolian" => &static_lang_word_lists::DIFFENATOR_MONGOLIAN,
"Myanmar" => &static_lang_word_lists::DIFFENATOR_MYANMAR,
"Ol_Chiki" => &static_lang_word_lists::DIFFENATOR_OL_CHIKI,
"Oriya" => &static_lang_word_lists::DIFFENATOR_ORIYA,
"Osage" => &static_lang_word_lists::DIFFENATOR_OSAGE,
"Sinhala" => &static_lang_word_lists::DIFFENATOR_SINHALA,
"Syriac" => &static_lang_word_lists::DIFFENATOR_SYRIAC,
"Tamil" => &static_lang_word_lists::DIFFENATOR_TAMIL,
"Telugu" => &static_lang_word_lists::DIFFENATOR_TELUGU,
"Thai" => &static_lang_word_lists::DIFFENATOR_THAI,
"Thanaa" => &static_lang_word_lists::DIFFENATOR_THANAA,
"Tibetan" => &static_lang_word_lists::DIFFENATOR_TIBETAN,
"Tifinagh" => &static_lang_word_lists::DIFFENATOR_TIFINAGH,
"Vai" => &static_lang_word_lists::DIFFENATOR_VAI,
_ => return None,
};
Some(wl)
}
pub fn direction_from_script(script: Script) -> Option<Direction> {
match script {
script::ARABIC |
script::HEBREW |
script::SYRIAC |
script::THAANA |
script::CYPRIOT |
script::KHAROSHTHI |
script::PHOENICIAN |
script::NKO |
script::LYDIAN |
script::AVESTAN |
script::IMPERIAL_ARAMAIC |
script::INSCRIPTIONAL_PAHLAVI |
script::INSCRIPTIONAL_PARTHIAN |
script::OLD_SOUTH_ARABIAN |
script::OLD_TURKIC |
script::SAMARITAN |
script::MANDAIC |
script::MEROITIC_CURSIVE |
script::MEROITIC_HIEROGLYPHS |
script::MANICHAEAN |
script::MENDE_KIKAKUI |
script::NABATAEAN |
script::OLD_NORTH_ARABIAN |
script::PALMYRENE |
script::PSALTER_PAHLAVI |
script::HATRAN |
script::ADLAM |
script::HANIFI_ROHINGYA |
script::OLD_SOGDIAN |
script::SOGDIAN |
script::ELYMAIC |
script::CHORASMIAN |
script::YEZIDI |
script::OLD_UYGHUR |
script::GARAY => {
Some(Direction::RightToLeft)
}
script::OLD_HUNGARIAN |
script::OLD_ITALIC |
script::RUNIC |
script::TIFINAGH => {
None
}
_ => Some(Direction::LeftToRight),
}
}