pub struct OutlineGlyphs<'a> {
font: &'a Font,
base: Base<'a>,
varc: Option<&'a Outlines<'a>>,
}Expand description
Provides access to the glyph outlines in a font.
The sources used for drawing are selected when this is created. It is cheap to create and copy because it only borrows tables that the font has already parsed.
Fields§
§font: &'a Font§base: Base<'a>§varc: Option<&'a Outlines<'a>>Implementations§
Source§impl<'a> OutlineGlyphs<'a>
impl<'a> OutlineGlyphs<'a>
pub(crate) fn new(font: &'a Font, order: GlyphSourceOrder) -> Self
Sourcepub fn source(&self) -> Option<OutlineSource>
pub fn source(&self) -> Option<OutlineSource>
Returns the table that provides the outlines.
This is OutlineSource::Varc if VARC composites are drawn. The
composites cover only some glyphs, and the rest come from the
underlying_source. Returns None if the
font has no outlines from the requested sources.
Sourcepub fn underlying_source(&self) -> Option<OutlineSource>
pub fn underlying_source(&self) -> Option<OutlineSource>
Returns the table that draws the glyphs VARC does not cover and the
components of those it does.
This is the same as source unless VARC
composites are drawn, and is never OutlineSource::Varc. Returns
None if the font has no outlines from the requested sources.
Sourcepub(crate) fn varc_covers(&self, glyph: GlyphId) -> bool
pub(crate) fn varc_covers(&self, glyph: GlyphId) -> bool
Returns true if glyph is drawn as a VARC composite.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the font has no outlines from the requested sources.
Sourcepub fn len(&self) -> u32
pub fn len(&self) -> u32
Returns the number of glyphs in the font.
Returns zero if the font has no outlines from the requested sources.
Sourcepub fn get(&self, glyph: GlyphId) -> Option<OutlineGlyph<'a>>
pub fn get(&self, glyph: GlyphId) -> Option<OutlineGlyph<'a>>
Returns the outline for glyph, or None if it has no outline or
its data in the base source cannot be read.
If VARC is enabled and the table covers the glyph, this returns a
VARC composite. Otherwise, the outline comes from the base source.
A composite that is malformed or nests past the recursion or edge
limits returns an error when it is drawn.
Sourcefn get_base(&self, glyph: GlyphId) -> Option<OutlineGlyph<'a>>
fn get_base(&self, glyph: GlyphId) -> Option<OutlineGlyph<'a>>
Returns the outline for glyph from the base source only.
Sourcepub fn iter(&self) -> impl Iterator<Item = (GlyphId, OutlineGlyph<'a>)> + 'a
pub fn iter(&self) -> impl Iterator<Item = (GlyphId, OutlineGlyph<'a>)> + 'a
Returns an iterator over every glyph that has an outline, in glyph identifier order.
Sourcepub(super) fn draw_base(
&self,
glyph: GlyphId,
coords: &[F2Dot14],
options: &DrawOptions,
precision: Precision,
buf: &mut [u8],
sink: &mut dyn PathSink,
) -> Result<(), Error>
pub(super) fn draw_base( &self, glyph: GlyphId, coords: &[F2Dot14], options: &DrawOptions, precision: Precision, buf: &mut [u8], sink: &mut dyn PathSink, ) -> Result<(), Error>
Draws glyph from the base source at coords.
This is used for the components of a composite. The coords may
differ from the font’s location.
Sourcepub(super) fn base_buffer_size(&self, glyph: GlyphId) -> usize
pub(super) fn base_buffer_size(&self, glyph: GlyphId) -> usize
Returns the size in bytes of the working memory needed to draw
glyph from the base source.
Trait Implementations§
Source§impl<'a> Clone for OutlineGlyphs<'a>
impl<'a> Clone for OutlineGlyphs<'a>
Source§fn clone(&self) -> OutlineGlyphs<'a>
fn clone(&self) -> OutlineGlyphs<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<'a> Copy for OutlineGlyphs<'a>
Source§impl<'yoke> Yokeable<'yoke> for OutlineGlyphs<'static>
impl<'yoke> Yokeable<'yoke> for OutlineGlyphs<'static>
Source§type Output = OutlineGlyphs<'yoke>
type Output = OutlineGlyphs<'yoke>
Self with the 'static replaced with 'a, i.e. Self<'a>