pub struct Font<'a> { /* private fields */ }Expand description
Shallowly parsed OpenType font.
Implementations§
Source§impl<'a> Font<'a>
impl<'a> Font<'a>
Sourcepub fn opentype(bytes: &'a [u8]) -> Result<Self, ParseError>
pub fn opentype(bytes: &'a [u8]) -> Result<Self, ParseError>
Parses bytes as an OpenType font. This is a shortcut for instantiating and reading
from an OpenTypeReader.
§Errors
Returns parsing errors.
Sourcepub fn naming(&self) -> FontNaming<'_>
pub fn naming(&self) -> FontNaming<'_>
Returns naming information for this font.
Sourcepub fn permissions(&self) -> UsagePermissions
pub fn permissions(&self) -> UsagePermissions
Gets usage permissions for this font.
Sourcepub fn created_at(&self) -> LongDateTime
pub fn created_at(&self) -> LongDateTime
Returns the “created at” timestamp for the font.
Sourcepub fn modified_at(&self) -> LongDateTime
pub fn modified_at(&self) -> LongDateTime
Returns the “modified at” timestamp for the font.
Sourcepub fn category(&self) -> FontCategory
pub fn category(&self) -> FontCategory
Returns the basic font category.
Sourcepub fn metrics(&self) -> FontMetrics
pub fn metrics(&self) -> FontMetrics
Returns basic font metrics read from head, hhea and hmtx tables.
Sourcepub fn is_variable(&self) -> bool
pub fn is_variable(&self) -> bool
Checks whether this font is variable. This returns true iff Self::variation_axes()
returns Some(_).
Sourcepub fn variation_axes(&self) -> Option<&[VariationAxis]>
pub fn variation_axes(&self) -> Option<&[VariationAxis]>
Returns variation axes for this font.
Sourcepub fn contains_char(&self, ch: char) -> bool
pub fn contains_char(&self, ch: char) -> bool
Checks whether the font contains a glyph for the specified char.
Sourcepub fn char_ranges(&self) -> impl Iterator<Item = RangeInclusive<char>> + '_
pub fn char_ranges(&self) -> impl Iterator<Item = RangeInclusive<char>> + '_
Iterates over char ranges covered by this font.
Sourcepub fn glyph_count(&self) -> usize
pub fn glyph_count(&self) -> usize
Returns the total glyph count in this font.
Sourcepub fn drop_variation(&mut self)
pub fn drop_variation(&mut self)
Drops variable font tables if they are present.