bitsy_parser/
text.rs

1#[derive(Clone, Debug, Eq, PartialEq)]
2pub enum Font {
3    AsciiSmall, // default - does not appear in game data
4    UnicodeEuropeanSmall,
5    UnicodeEuropeanLarge,
6    UnicodeAsian,
7    Arabic,
8    Custom,
9}
10
11impl Font {
12    pub(crate) fn from(str: &str) -> Font {
13        match str {
14            "unicode_european_small" => Font::UnicodeEuropeanSmall,
15            "unicode_european_large" => Font::UnicodeEuropeanLarge,
16            "unicode_asian"          => Font::UnicodeAsian,
17            "arabic"                 => Font::Arabic,
18            _                        => Font::Custom,
19        }
20    }
21
22    pub(crate) fn to_string(&self) -> Result<String, crate::Error> {
23        match &self {
24            Font::UnicodeEuropeanSmall => Ok("unicode_european_small".to_string()),
25            Font::UnicodeEuropeanLarge => Ok("unicode_european_large".to_string()),
26            Font::UnicodeAsian         => Ok("unicode_asian".to_string()),
27            Font::Arabic               => Ok("arabic".to_string()),
28            _                          => Err(crate::Error::Font),
29        }
30    }
31}
32
33#[derive(Clone, Debug, Eq, PartialEq)]
34pub enum TextDirection {
35    LeftToRight, // default
36    RightToLeft,
37}