pub struct Glyph {
pub height: f64,
pub width: f64,
pub codepoints: Codepoints,
pub note: Option<String>,
pub guidelines: Vec<Guideline>,
pub anchors: Vec<Anchor>,
pub components: Vec<Component>,
pub contours: Vec<Contour>,
pub image: Option<Image>,
pub lib: Plist,
/* private fields */
}Expand description
A glyph, loaded from a .glif file.
Norad can load glif version 1.0 and 2.0, and can save 2.0 only.
Fields§
§height: f64Glyph height.
width: f64Glyph width.
codepoints: CodepointsA collection of glyph Unicode code points.
The first entry defines the primary Unicode value for this glyph.
note: Option<String>Arbitrary glyph note.
guidelines: Vec<Guideline>A collection of glyph guidelines.
anchors: Vec<Anchor>A collection of glyph anchors.
components: Vec<Component>A collection of glyph components.
contours: Vec<Contour>A collection of glyph contours.
image: Option<Image>Glyph image data.
lib: PlistGlyph library data.
Implementations§
Source§impl Glyph
impl Glyph
Sourcepub fn encode_xml(&self) -> Result<Vec<u8>, GlifWriteError>
pub fn encode_xml(&self) -> Result<Vec<u8>, GlifWriteError>
Serialize the glyph into an XML byte stream.
The order of elements and attributes follows ufonormalizer where possible.
Sourcepub fn encode_xml_with_options(
&self,
opts: &WriteOptions,
) -> Result<Vec<u8>, GlifWriteError>
pub fn encode_xml_with_options( &self, opts: &WriteOptions, ) -> Result<Vec<u8>, GlifWriteError>
Serialize the glyph into an XML byte stream with custom string formatting.
The order of elements and attributes follows ufonormalizer where possible.
Source§impl Glyph
impl Glyph
Sourcepub fn load(path: impl AsRef<Path>) -> Result<Self, GlifLoadError>
pub fn load(path: impl AsRef<Path>) -> Result<Self, GlifLoadError>
Attempt to parse a Glyph from a .glif at the provided path.
Sourcepub fn new(name: &str) -> Self
pub fn new(name: &str) -> Self
Returns a new, “empty” Glyph with the given name.
§Panics
panics if name is empty or if it contains any control characters.
Sourcepub fn has_component(&self) -> bool
pub fn has_component(&self) -> bool
Sourcepub fn component_count(&self) -> usize
pub fn component_count(&self) -> usize
Returns the number of Components in the Glyph.
Sourcepub fn has_component_with_base(&self, basename: &str) -> bool
pub fn has_component_with_base(&self, basename: &str) -> bool
Returns true if the Glyph contains one or more Components with base
glyph name basename.