Type Alias theme_parser::parser::pff2::Parser
source · pub type Parser = Pff2<Unchecked>;
Expand description
A type used for parsing the PFF2 format. This is separate from Font
to make sure that the font data is validated
before it will be used by the code that expects certain properties from a font. See Parser::validate
for details
on the requiements.
Aliased Type§
struct Parser {
pub name: String,
pub family: String,
pub point_size: u16,
pub weight: String,
pub max_char_width: u16,
pub max_char_height: u16,
pub ascent: u16,
pub descent: u16,
pub leading: u16,
pub glyphs: Rc<[Glyph]>,
/* private fields */
}
Fields§
§name: String
Font name. Usually includes family, point size and weight
family: String
Font family
point_size: u16
Size of the font
weight: String
Weight could be anything like normal, bold or italic
max_char_width: u16
The dimetions of the glyphs
max_char_height: u16
The dimetions of the glyphs
ascent: u16
The highest point on the glyph (like the top of M
)
descent: u16
The lowest point on the glyph (like the bottom of g
)
leading: u16
The distance between baselines
glyphs: Rc<[Glyph]>
A list of glyphs that are in the font
Implementations§
source§impl Parser
impl Parser
sourcepub fn validate(self) -> Result<Font, FontValidationError>
pub fn validate(self) -> Result<Font, FontValidationError>
Validates Self
to be a valid font that can be used for rendering. See FontValidationError
for reasons a
font may be invalid.