//! Generated by glyphs-reader/data/update.py

use crate::{
    glyphdata::{Category, Script, Subcategory},
    glyphdata_bundled::BundledEntry,
};
impl BundledEntry for Category {
    fn element_size() -> usize {
        1
    }
    fn from_slice(raw: &[u8]) -> Category {
        match raw[0] {
            0 => Category::Letter,
            1 => Category::Mark,
            2 => Category::Number,
            3 => Category::Punctuation,
            4 => Category::Separator,
            5 => Category::Symbol,
            v => panic!("What is {v}"),
        }
    }
}

/// The subcategory of a given glyph
impl BundledEntry for Option<Subcategory> {
    fn element_size() -> usize {
        1
    }
    fn from_slice(raw: &[u8]) -> Option<Subcategory> {
        match raw[0] {
            0 => Some(Subcategory::Arrow),
            1 => Some(Subcategory::Compatibility),
            2 => Some(Subcategory::Currency),
            3 => Some(Subcategory::Dash),
            4 => Some(Subcategory::DecimalDigit),
            5 => Some(Subcategory::Emoji),
            6 => Some(Subcategory::Enclosing),
            7 => Some(Subcategory::Format),
            8 => Some(Subcategory::Fraction),
            9 => Some(Subcategory::Geometry),
            10 => Some(Subcategory::Halfform),
            11 => Some(Subcategory::Jamo),
            12 => Some(Subcategory::Letter),
            13 => Some(Subcategory::Ligature),
            14 => Some(Subcategory::Math),
            15 => Some(Subcategory::Matra),
            16 => Some(Subcategory::Modifier),
            17 => Some(Subcategory::Nonspacing),
            18 => Some(Subcategory::Parenthesis),
            19 => Some(Subcategory::Quote),
            20 => Some(Subcategory::Radical),
            21 => Some(Subcategory::Small),
            22 => Some(Subcategory::Space),
            23 => Some(Subcategory::Spacing),
            24 => Some(Subcategory::SpacingCombining),
            25 => Some(Subcategory::Superscript),
            26 => Some(Subcategory::Syllable),
            255 => None,
            v => panic!("What is {v}"),
        }
    }
}

/// The script of a given glyph
impl BundledEntry for Option<Script> {
    fn element_size() -> usize {
        1
    }
    fn from_slice(raw: &[u8]) -> Option<Script> {
        match raw[0] {
            0 => Some(Script::Adlam),
            1 => Some(Script::Alchemical),
            2 => Some(Script::Arabic),
            3 => Some(Script::Armenian),
            4 => Some(Script::Avestan),
            5 => Some(Script::Balinese),
            6 => Some(Script::Bamum),
            7 => Some(Script::Batak),
            8 => Some(Script::Bengali),
            9 => Some(Script::BlackLetter),
            10 => Some(Script::Bopomofo),
            11 => Some(Script::Brahmi),
            12 => Some(Script::Braille),
            13 => Some(Script::Buginese),
            14 => Some(Script::Canadian),
            15 => Some(Script::Chakma),
            16 => Some(Script::Cham),
            17 => Some(Script::Cherokee),
            18 => Some(Script::Chorasmian),
            19 => Some(Script::Coptic),
            20 => Some(Script::Cyrillic),
            21 => Some(Script::Dentistry),
            22 => Some(Script::Deseret),
            23 => Some(Script::Devanagari),
            24 => Some(Script::Divesakuru),
            25 => Some(Script::Elbasan),
            26 => Some(Script::Elymaic),
            27 => Some(Script::Ethiopic),
            28 => Some(Script::Georgian),
            29 => Some(Script::Glagolitic),
            30 => Some(Script::Gothic),
            31 => Some(Script::Greek),
            32 => Some(Script::Gujarati),
            33 => Some(Script::Gurmukhi),
            34 => Some(Script::Han),
            35 => Some(Script::Hangul),
            36 => Some(Script::Hebrew),
            37 => Some(Script::Javanese),
            38 => Some(Script::Kana),
            39 => Some(Script::Kannada),
            40 => Some(Script::Kawi),
            41 => Some(Script::Kayahli),
            42 => Some(Script::Khmer),
            43 => Some(Script::Khojki),
            44 => Some(Script::Lao),
            45 => Some(Script::Latin),
            46 => Some(Script::Lepcha),
            47 => Some(Script::Lue),
            48 => Some(Script::Mahjong),
            49 => Some(Script::Malayalam),
            50 => Some(Script::Mandaic),
            51 => Some(Script::Math),
            52 => Some(Script::Mongolian),
            53 => Some(Script::Musical),
            54 => Some(Script::Myanmar),
            55 => Some(Script::Nko),
            56 => Some(Script::NyiakengPuachueHmong),
            57 => Some(Script::Ogham),
            58 => Some(Script::Oriya),
            59 => Some(Script::Osage),
            60 => Some(Script::Osmanya),
            61 => Some(Script::PahawhHmong),
            62 => Some(Script::PhaistosDisc),
            63 => Some(Script::Rovas),
            64 => Some(Script::Runic),
            65 => Some(Script::Samaritan),
            66 => Some(Script::Shavian),
            67 => Some(Script::Sinhala),
            68 => Some(Script::Syriac),
            69 => Some(Script::Tamil),
            70 => Some(Script::Telugu),
            71 => Some(Script::Thaana),
            72 => Some(Script::Thai),
            73 => Some(Script::Tham),
            74 => Some(Script::Tibet),
            75 => Some(Script::Tifinagh),
            76 => Some(Script::Vai),
            77 => Some(Script::Yezidi),
            78 => Some(Script::Yi),
            255 => None,
            v => panic!("What is {v}"),
        }
    }
}
