pub(crate) struct Outlines<'a> {
varc: Varc<'a>,
coverage: CoverageTable<'a>,
var_store: Option<MultiItemVariationStore<'a>>,
regions: Option<SparseVariationRegionList<'a>>,
units_per_em: u16,
axis_count: usize,
index_count: usize,
}Expand description
Provides access to the variable composite glyphs in a font.
Fields§
§varc: Varc<'a>§coverage: CoverageTable<'a>§var_store: Option<MultiItemVariationStore<'a>>§regions: Option<SparseVariationRegionList<'a>>§units_per_em: u16§axis_count: usize§index_count: usizeThe length of the longest axis index list in the table.
A list longer than axis_count repeats an axis, and the later value
wins.
Implementations§
Source§impl<'a> Outlines<'a>
impl<'a> Outlines<'a>
Sourcepub(crate) fn new(
varc: Varc<'a>,
units_per_em: u16,
axis_count: usize,
) -> Result<Self, ReadError>
pub(crate) fn new( varc: Varc<'a>, units_per_em: u16, axis_count: usize, ) -> Result<Self, ReadError>
Creates a new set of composite glyphs from varc.
axis_count is the number of variation axes that components can set.
A font without fvar can still have axes in gvar or the CFF2
variation store.
Sourcepub(crate) fn outline(&self, glyph: GlyphId) -> Option<Outline>
pub(crate) fn outline(&self, glyph: GlyphId) -> Option<Outline>
Returns the outline for glyph.
Returns None if the table does not cover the glyph. The tree is read
only when the glyph is drawn or its memory size is requested.
Sourcefn layout_of(
&self,
outline: &Outline,
context: &dyn VarcContext,
) -> Result<Layout, Error>
fn layout_of( &self, outline: &Outline, context: &dyn VarcContext, ) -> Result<Layout, Error>
Returns the memory layout for drawing outline, measuring its tree
the first time.
Fails if the glyph data is malformed or the tree passes the recursion or edge limits. Every component counts, whatever its condition, so the answer is the same at every location.
Sourcepub(crate) fn required_memory_size(
&self,
outline: &Outline,
context: &dyn VarcContext,
) -> usize
pub(crate) fn required_memory_size( &self, outline: &Outline, context: &dyn VarcContext, ) -> usize
Returns the size in bytes of the memory for drawing outline, or zero
if it cannot be drawn.
Sourcefn layout(&self, depth: usize, leaf: usize) -> Layout
fn layout(&self, depth: usize, leaf: usize) -> Layout
Returns the memory layout for a composite.
depth is the nesting depth and leaf is the size in bytes of the
largest leaf.
Sourcefn region_count(&self) -> usize
fn region_count(&self) -> usize
Returns the number of variation regions, or zero if the table has no variation store.
Sourcefn measure(
&self,
glyph: GlyphId,
coverage_index: u32,
context: &dyn VarcContext,
walk: &mut Walk,
) -> Result<usize, ReadError>
fn measure( &self, glyph: GlyphId, coverage_index: u32, context: &dyn VarcContext, walk: &mut Walk, ) -> Result<usize, ReadError>
Measures the tree under a composite.
Returns the size in bytes of the largest leaf and records the deepest
nesting in walk. Every component is counted regardless of its
condition, so the result is valid for any location.
Sourcepub(crate) fn draw(
&self,
outline: &Outline,
context: &dyn VarcContext,
ppem: Option<f32>,
buf: &mut [u8],
sink: &mut dyn PathSink,
) -> Result<(), Error>
pub(crate) fn draw( &self, outline: &Outline, context: &dyn VarcContext, ppem: Option<f32>, buf: &mut [u8], sink: &mut dyn PathSink, ) -> Result<(), Error>
Draws outline into sink at the location provided by context.
The glyphs at the leaves are drawn by context. ppem is the size of
the leaves, or None for font units. It also scales the component
offsets. buf must hold at least
required_memory_size bytes.
Sourcefn draw_tree(
&self,
outline: &Outline,
layout: &Layout,
context: &dyn VarcContext,
ppem: Option<f32>,
memory: Memory<'_>,
sink: &mut dyn PathSink,
) -> Result<(), Error>
fn draw_tree( &self, outline: &Outline, layout: &Layout, context: &dyn VarcContext, ppem: Option<f32>, memory: Memory<'_>, sink: &mut dyn PathSink, ) -> Result<(), Error>
Implements draw with memory that is already split
into slices.
fn draw_glyph( &self, glyph: GlyphId, coverage_index: u32, current_coords: &[F2Dot14], parent_matrix: Matrix<f32>, draw: &DrawContext<'a, '_>, scalar_cache: &mut ScalarCache<'_>, levels: Levels<'_>, leaf: &mut [u8], sink: &mut dyn PathSink, stack: &mut GlyphStack, scratch: &mut Scratch<'_>, ) -> Result<(), Error>
Sourcefn component_coords(
&self,
component: &VarcComponent<'_>,
current_coords: &[F2Dot14],
coords: &mut [F2Dot14],
scalar_cache: &mut ScalarCache<'_>,
scratch: &mut Scratch<'_>,
font_coords: &[F2Dot14],
store_regions: Option<(&MultiItemVariationStore<'a>, &SparseVariationRegionList<'a>)>,
) -> Result<(), Error>
fn component_coords( &self, component: &VarcComponent<'_>, current_coords: &[F2Dot14], coords: &mut [F2Dot14], scalar_cache: &mut ScalarCache<'_>, scratch: &mut Scratch<'_>, font_coords: &[F2Dot14], store_regions: Option<(&MultiItemVariationStore<'a>, &SparseVariationRegionList<'a>)>, ) -> Result<(), Error>
Writes the coordinates for drawing component to coords.
coords holds one value per axis.
Sourcefn axis_indices(&self, nth: usize, out: &mut [u16]) -> Result<usize, ReadError>
fn axis_indices(&self, nth: usize, out: &mut [u16]) -> Result<usize, ReadError>
Reads the nth list of axis indices into out and returns the
number of indices.
fn component_condition_met( &self, component: &VarcComponent<'_>, coords: &[F2Dot14], scalar_cache: &mut ScalarCache<'_>, scratch: &mut Scratch<'_>, store_regions: Option<(&MultiItemVariationStore<'a>, &SparseVariationRegionList<'a>)>, ) -> Result<bool, Error>
Trait Implementations§
Source§impl<'yoke> Yokeable<'yoke> for Outlines<'static>
impl<'yoke> Yokeable<'yoke> for Outlines<'static>
Source§type Output = Outlines<'yoke>
type Output = Outlines<'yoke>
Self with the 'static replaced with 'a, i.e. Self<'a>