Expand description
§glifnames.rlib
Map a character to a glyph name according to the Adobe Glyph List Specification.
§Example
use std::borrow::Cow;
use glifnames::GlyphName as _;
use glifnames::{AGLFN, LegacyAGL};
assert_eq!(LegacyAGL::glyph_name_impl('コ' as u32), Some(Cow::from("kokatakana"))); // ko
assert_eq!(LegacyAGL::glyph_name_impl('ピ' as u32), Some(Cow::from("pikatakana"))); // pi
assert_eq!(LegacyAGL::glyph_name_impl('ペ' as u32), Some(Cow::from("pekatakana"))); // pe
assert_eq!(AGLFN::glyph_name_impl('★' as u32), Some(Cow::from("uni2605"))); // 星 hoshi!!
assert_eq!(AGLFN::glyph_name_impl('☺' as u32), Some(Cow::from("smileface"))); // (´・ω・`)
// Failure cases:
assert_eq!(AGLFN::glyph_name_impl(0xfffffff), None);
assert_eq!(AGLFN::glyph_name(0xfffffff), <&str as Into<Cow<'_, str>>>::into(".invalid.000000000FFFFFFF"));
Re-exports§
pub use traits::GlyphName;
pub use traits::GlyphNameStrict;
Modules§
- Traits you can implement
Structs§
- Adobe Glyph List for New Fonts (2019 edition)
- Legacy Adobe Glyph List (2002–2008)
- ITC Zapf Dingbats Glyph List (2002)
Functions§
- Guaranteed to return even when
char::from
fails. - Glyph names for invalid Unicode codepoints of the format
.invalid.F000000000000000
- It is recommended to specify names by using the ‘uni’ prefix for characters in the Basic Multilingual Plane (BMP), and the shorter ‘u’ prefix for characters in the 16 Supplemental Planes. https://github.com/adobe-type-tools/agl-specification#6-assigning-glyph-names-in-new-fonts