Crate glifnames

Crate glifnames 

Source
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
Traits you can implement

Structs§

AGLFN
Adobe Glyph List for New Fonts (2019 edition)
LegacyAGL
Legacy Adobe Glyph List (2002–2008)
ZapfDingbats
ITC Zapf Dingbats Glyph List (2002)

Functions§

glyph_name
Guaranteed to return even when char::from fails.
invalid_glyph_name
Glyph names for invalid Unicode codepoints of the format .invalid.F000000000000000
unicode_glyph_name
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