names.rs

6.0 kB · rust · 114 lines

1/// Returns the character's Unicode name, or a U+ code point label for a character outside the font.2pub fn name_of(c: char) -> String {3    match c {4        '\u{0041}' => "LATIN CAPITAL LETTER A".to_string(),5        '\u{0042}' => "LATIN CAPITAL LETTER B".to_string(),6        '\u{0043}' => "LATIN CAPITAL LETTER C".to_string(),7        '\u{0044}' => "LATIN CAPITAL LETTER D".to_string(),8        '\u{0045}' => "LATIN CAPITAL LETTER E".to_string(),9        '\u{0046}' => "LATIN CAPITAL LETTER F".to_string(),10        '\u{0047}' => "LATIN CAPITAL LETTER G".to_string(),11        '\u{0048}' => "LATIN CAPITAL LETTER H".to_string(),12        '\u{0049}' => "LATIN CAPITAL LETTER I".to_string(),13        '\u{004a}' => "LATIN CAPITAL LETTER J".to_string(),14        '\u{004b}' => "LATIN CAPITAL LETTER K".to_string(),15        '\u{004c}' => "LATIN CAPITAL LETTER L".to_string(),16        '\u{004d}' => "LATIN CAPITAL LETTER M".to_string(),17        '\u{004e}' => "LATIN CAPITAL LETTER N".to_string(),18        '\u{004f}' => "LATIN CAPITAL LETTER O".to_string(),19        '\u{0050}' => "LATIN CAPITAL LETTER P".to_string(),20        '\u{0051}' => "LATIN CAPITAL LETTER Q".to_string(),21        '\u{0052}' => "LATIN CAPITAL LETTER R".to_string(),22        '\u{0053}' => "LATIN CAPITAL LETTER S".to_string(),23        '\u{0054}' => "LATIN CAPITAL LETTER T".to_string(),24        '\u{0055}' => "LATIN CAPITAL LETTER U".to_string(),25        '\u{0056}' => "LATIN CAPITAL LETTER V".to_string(),26        '\u{0057}' => "LATIN CAPITAL LETTER W".to_string(),27        '\u{0058}' => "LATIN CAPITAL LETTER X".to_string(),28        '\u{0059}' => "LATIN CAPITAL LETTER Y".to_string(),29        '\u{005a}' => "LATIN CAPITAL LETTER Z".to_string(),30        '\u{0061}' => "LATIN SMALL LETTER A".to_string(),31        '\u{0062}' => "LATIN SMALL LETTER B".to_string(),32        '\u{0063}' => "LATIN SMALL LETTER C".to_string(),33        '\u{0064}' => "LATIN SMALL LETTER D".to_string(),34        '\u{0065}' => "LATIN SMALL LETTER E".to_string(),35        '\u{0066}' => "LATIN SMALL LETTER F".to_string(),36        '\u{0067}' => "LATIN SMALL LETTER G".to_string(),37        '\u{0068}' => "LATIN SMALL LETTER H".to_string(),38        '\u{0069}' => "LATIN SMALL LETTER I".to_string(),39        '\u{006a}' => "LATIN SMALL LETTER J".to_string(),40        '\u{006b}' => "LATIN SMALL LETTER K".to_string(),41        '\u{006c}' => "LATIN SMALL LETTER L".to_string(),42        '\u{006d}' => "LATIN SMALL LETTER M".to_string(),43        '\u{006e}' => "LATIN SMALL LETTER N".to_string(),44        '\u{006f}' => "LATIN SMALL LETTER O".to_string(),45        '\u{0070}' => "LATIN SMALL LETTER P".to_string(),46        '\u{0071}' => "LATIN SMALL LETTER Q".to_string(),47        '\u{0072}' => "LATIN SMALL LETTER R".to_string(),48        '\u{0073}' => "LATIN SMALL LETTER S".to_string(),49        '\u{0074}' => "LATIN SMALL LETTER T".to_string(),50        '\u{0075}' => "LATIN SMALL LETTER U".to_string(),51        '\u{0076}' => "LATIN SMALL LETTER V".to_string(),52        '\u{0077}' => "LATIN SMALL LETTER W".to_string(),53        '\u{0078}' => "LATIN SMALL LETTER X".to_string(),54        '\u{0079}' => "LATIN SMALL LETTER Y".to_string(),55        '\u{007a}' => "LATIN SMALL LETTER Z".to_string(),56        '\u{0030}' => "DIGIT ZERO".to_string(),57        '\u{0031}' => "DIGIT ONE".to_string(),58        '\u{0032}' => "DIGIT TWO".to_string(),59        '\u{0033}' => "DIGIT THREE".to_string(),60        '\u{0034}' => "DIGIT FOUR".to_string(),61        '\u{0035}' => "DIGIT FIVE".to_string(),62        '\u{0036}' => "DIGIT SIX".to_string(),63        '\u{0037}' => "DIGIT SEVEN".to_string(),64        '\u{0038}' => "DIGIT EIGHT".to_string(),65        '\u{0039}' => "DIGIT NINE".to_string(),66        '\u{0020}' => "SPACE".to_string(),67        '\u{002e}' => "FULL STOP".to_string(),68        '\u{002c}' => "COMMA".to_string(),69        '\u{0027}' => "APOSTROPHE".to_string(),70        '\u{0060}' => "GRAVE ACCENT".to_string(),71        '\u{0022}' => "QUOTATION MARK".to_string(),72        '\u{003a}' => "COLON".to_string(),73        '\u{003b}' => "SEMICOLON".to_string(),74        '\u{0021}' => "EXCLAMATION MARK".to_string(),75        '\u{00a1}' => "INVERTED EXCLAMATION MARK".to_string(),76        '\u{003f}' => "QUESTION MARK".to_string(),77        '\u{00bf}' => "INVERTED QUESTION MARK".to_string(),78        '\u{005e}' => "CIRCUMFLEX ACCENT".to_string(),79        '\u{005f}' => "LOW LINE".to_string(),80        '\u{007c}' => "VERTICAL LINE".to_string(),81        '\u{005c}' => "REVERSE SOLIDUS".to_string(),82        '\u{002f}' => "SOLIDUS".to_string(),83        '\u{003c}' => "LESS-THAN SIGN".to_string(),84        '\u{003e}' => "GREATER-THAN SIGN".to_string(),85        '\u{2190}' => "LEFTWARDS ARROW".to_string(),86        '\u{2191}' => "UPWARDS ARROW".to_string(),87        '\u{2192}' => "RIGHTWARDS ARROW".to_string(),88        '\u{2193}' => "DOWNWARDS ARROW".to_string(),89        '\u{002d}' => "HYPHEN-MINUS".to_string(),90        '\u{2014}' => "EM DASH".to_string(),91        '\u{00b7}' => "MIDDLE DOT".to_string(),92        '\u{003d}' => "EQUALS SIGN".to_string(),93        '\u{002b}' => "PLUS SIGN".to_string(),94        '\u{2212}' => "MINUS SIGN".to_string(),95        '\u{00d7}' => "MULTIPLICATION SIGN".to_string(),96        '\u{00f7}' => "DIVISION SIGN".to_string(),97        '\u{002a}' => "ASTERISK".to_string(),98        '\u{0023}' => "NUMBER SIGN".to_string(),99        '\u{0025}' => "PERCENT SIGN".to_string(),100        '\u{007e}' => "TILDE".to_string(),101        '\u{0026}' => "AMPERSAND".to_string(),102        '\u{0028}' => "LEFT PARENTHESIS".to_string(),103        '\u{0029}' => "RIGHT PARENTHESIS".to_string(),104        '\u{005b}' => "LEFT SQUARE BRACKET".to_string(),105        '\u{005d}' => "RIGHT SQUARE BRACKET".to_string(),106        '\u{007b}' => "LEFT CURLY BRACKET".to_string(),107        '\u{007d}' => "RIGHT CURLY BRACKET".to_string(),108        '\u{0024}' => "DOLLAR SIGN".to_string(),109        '\u{0040}' => "COMMERCIAL AT".to_string(),110        '\u{00a9}' => "COPYRIGHT SIGN".to_string(),111        '\u{00ae}' => "REGISTERED SIGN".to_string(),112        other => format!("U+{:04X}", other as u32),113    }114}