8000 Add is_recommended() · popzxc/unicode-script@d86a110 · GitHub
[go: up one dir, main page]

Skip to content

Commit d86a110

Browse files
committed
Add is_recommended()
1 parent f156781 commit d86a110

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/lib.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ impl Script {
2020
pub fn short_name(self) -> &'static str {
2121
self.inner_short_name()
2222
}
23+
24+
/// Is this script "Recommended" according to
25+
/// [UAX #31](www.unicode.org/reports/tr31/#Table_Recommended_Scripts)?
26+
pub fn is_recommended(self) -> bool {
27+
use Script::*;
28+
match self {
29+
Common | Inherited | Arabic | Armenian | Bengali | Bopomofo | Cyrillic | Devanagari
30+
| Ethiopic | Georgian | Greek | Gujarati | Gurmukhi | Han | Hangul | Hebrew
31+
| Hiragana | Kannada | Katakana | Khmer | Lao | Latin | Malayalam | Myanmar | Oriya
32+
| Sinhala | Tamil | Telugu | Thaana | Thai | Tibetan => true,
33+
_ => false,
34+
}
35+
}
2336
}
2437

2538
impl From<char> for Script {

0 commit comments

Comments
 (0)
0