pub(super) struct ColrInstance<'a> {
tables: &'a ColrTables<'a>,
coords: &'a [F2Dot14],
scalars: &'a [Fixed],
}Expand description
A COLR table bound to a location in variation space for resolving
paints.
See resolve_paint, ColorStops::resolve and resolve_clip_box.
Fields§
§tables: &'a ColrTables<'a>§coords: &'a [F2Dot14]§scalars: &'a [Fixed]The variation store’s region scalars at coords, where they are
known. Any region past the end is computed for each delta.
Implementations§
Source§impl<'a> ColrInstance<'a>
impl<'a> ColrInstance<'a>
Sourcepub(super) fn new(
tables: &'a ColrTables<'a>,
coords: &'a [F2Dot14],
scalars: &'a [Fixed],
) -> Self
pub(super) fn new( tables: &'a ColrTables<'a>, coords: &'a [F2Dot14], scalars: &'a [Fixed], ) -> Self
Creates an instance for tables at the normalized variation
coordinates coords, with the region scalars already computed
there.
Methods from Deref<Target = Colr<'a>>§
pub fn v0_closure_palette_indices( &self, glyph_set: &IntSet<GlyphId>, palette_indices: &mut IntSet<u16>, )
Sourcepub fn v1_closure(
&self,
glyph_set: &mut IntSet<GlyphId>,
layer_indices: &mut IntSet<u32>,
palette_indices: &mut IntSet<u16>,
variation_indices: &mut IntSet<u32>,
)
pub fn v1_closure( &self, glyph_set: &mut IntSet<GlyphId>, layer_indices: &mut IntSet<u32>, palette_indices: &mut IntSet<u16>, variation_indices: &mut IntSet<u32>, )
Collect the transitive closure of v1 glyphs,layer/paletted indices and variation/delta set indices for COLRv1
Sourcepub fn v0_closure_glyphs(
&self,
glyph_set: &IntSet<GlyphId>,
glyphset_colrv0: &mut IntSet<GlyphId>,
)
pub fn v0_closure_glyphs( &self, glyph_set: &IntSet<GlyphId>, glyphset_colrv0: &mut IntSet<GlyphId>, )
Collect the transitive closure of V0 glyphs needed for all of the input glyphs set
pub const MIN_SIZE: usize
Sourcepub fn resolve_offset<O: Offset, R: FontRead<'a, Args = ()>>(
&self,
offset: O,
) -> Result<R, ReadError>
pub fn resolve_offset<O: Offset, R: FontRead<'a, Args = ()>>( &self, offset: O, ) -> Result<R, ReadError>
Resolve the provided offset from the start of this table.
Sourcepub fn offset_data(&self) -> FontData<'a>
pub fn offset_data(&self) -> FontData<'a>
Return a reference to this table’s raw data.
We use this in the compile crate to resolve offsets.
Sourcepub fn shape(&self) -> &Self
👎Deprecated: just use the base type directly
pub fn shape(&self) -> &Self
just use the base type directly
Return a reference to the table’s ‘Shape’ struct.
This is a low level implementation detail, but it can be useful in some cases where you want to know things about a table’s layout, such as the byte offsets of specific fields.
Sourcepub fn num_base_glyph_records(&self) -> u16
pub fn num_base_glyph_records(&self) -> u16
Number of BaseGlyph records; may be 0 in a version 1 table.
Sourcepub fn base_glyph_records_offset(&self) -> Nullable<Offset32>
pub fn base_glyph_records_offset(&self) -> Nullable<Offset32>
Offset to baseGlyphRecords array (may be NULL).
Sourcepub fn base_glyph_records(&self) -> Option<Result<&'a [BaseGlyph], ReadError>>
pub fn base_glyph_records(&self) -> Option<Result<&'a [BaseGlyph], ReadError>>
Attempt to resolve base_glyph_records_offset.
Sourcepub fn layer_records_offset(&self) -> Nullable<Offset32>
pub fn layer_records_offset(&self) -> Nullable<Offset32>
Offset to layerRecords array (may be NULL).
Sourcepub fn layer_records(&self) -> Option<Result<&'a [Layer], ReadError>>
pub fn layer_records(&self) -> Option<Result<&'a [Layer], ReadError>>
Attempt to resolve layer_records_offset.
Sourcepub fn num_layer_records(&self) -> u16
pub fn num_layer_records(&self) -> u16
Number of Layer records; may be 0 in a version 1 table.
Sourcepub fn base_glyph_list_offset(&self) -> Option<Nullable<Offset32>>
pub fn base_glyph_list_offset(&self) -> Option<Nullable<Offset32>>
Offset to BaseGlyphList table.
Sourcepub fn base_glyph_list(&self) -> Option<Result<BaseGlyphList<'a>, ReadError>>
pub fn base_glyph_list(&self) -> Option<Result<BaseGlyphList<'a>, ReadError>>
Attempt to resolve base_glyph_list_offset.
Sourcepub fn layer_list_offset(&self) -> Option<Nullable<Offset32>>
pub fn layer_list_offset(&self) -> Option<Nullable<Offset32>>
Offset to LayerList table (may be NULL).
Sourcepub fn layer_list(&self) -> Option<Result<LayerList<'a>, ReadError>>
pub fn layer_list(&self) -> Option<Result<LayerList<'a>, ReadError>>
Attempt to resolve layer_list_offset.
Sourcepub fn clip_list_offset(&self) -> Option<Nullable<Offset32>>
pub fn clip_list_offset(&self) -> Option<Nullable<Offset32>>
Offset to ClipList table (may be NULL).
Sourcepub fn clip_list(&self) -> Option<Result<ClipList<'a>, ReadError>>
pub fn clip_list(&self) -> Option<Result<ClipList<'a>, ReadError>>
Attempt to resolve clip_list_offset.
Sourcepub fn var_index_map_offset(&self) -> Option<Nullable<Offset32>>
pub fn var_index_map_offset(&self) -> Option<Nullable<Offset32>>
Offset to DeltaSetIndexMap table (may be NULL).
Sourcepub fn var_index_map(&self) -> Option<Result<DeltaSetIndexMap<'a>, ReadError>>
pub fn var_index_map(&self) -> Option<Result<DeltaSetIndexMap<'a>, ReadError>>
Attempt to resolve var_index_map_offset.
Sourcepub fn item_variation_store_offset(&self) -> Option<Nullable<Offset32>>
pub fn item_variation_store_offset(&self) -> Option<Nullable<Offset32>>
Offset to ItemVariationStore (may be NULL).
Sourcepub fn item_variation_store(
&self,
) -> Option<Result<ItemVariationStore<'a>, ReadError>>
pub fn item_variation_store( &self, ) -> Option<Result<ItemVariationStore<'a>, ReadError>>
Attempt to resolve item_variation_store_offset.
pub fn version_byte_range(&self) -> Range<usize> ⓘ
pub fn num_base_glyph_records_byte_range(&self) -> Range<usize> ⓘ
pub fn base_glyph_records_offset_byte_range(&self) -> Range<usize> ⓘ
pub fn layer_records_offset_byte_range(&self) -> Range<usize> ⓘ
pub fn num_layer_records_byte_range(&self) -> Range<usize> ⓘ
pub fn base_glyph_list_offset_byte_range(&self) -> Range<usize> ⓘ
pub fn layer_list_offset_byte_range(&self) -> Range<usize> ⓘ
pub fn clip_list_offset_byte_range(&self) -> Range<usize> ⓘ
pub fn var_index_map_offset_byte_range(&self) -> Range<usize> ⓘ
pub fn item_variation_store_offset_byte_range(&self) -> Range<usize> ⓘ
Sourcepub fn v0_base_glyph(&self, glyph_id: GlyphId) -> Option<Range<usize>>
pub fn v0_base_glyph(&self, glyph_id: GlyphId) -> Option<Range<usize>>
Returns the COLRv0 base glyph for the given glyph identifier.
The return value is a range of layer indices that can be passed to
v0_layer to retrieve the layer glyph identifiers
and palette color indices.
Sourcepub fn v0_layer(&self, index: usize) -> Option<(GlyphId16, u16)>
pub fn v0_layer(&self, index: usize) -> Option<(GlyphId16, u16)>
Returns the COLRv0 layer at the given index.
The layer is represented by a tuple containing the glyph identifier of the associated outline and the palette color index.
Sourcepub fn v1_base_glyph(&self, glyph_id: GlyphId) -> Option<(Paint<'a>, PaintId)>
pub fn v1_base_glyph(&self, glyph_id: GlyphId) -> Option<(Paint<'a>, PaintId)>
Returns the COLRv1 base glyph for the given glyph identifier.
The second value in the tuple is a unique identifier for the paint that may be used to detect recursion in the paint graph.
Sourcepub fn v1_layer(&self, index: usize) -> Option<(Paint<'a>, PaintId)>
pub fn v1_layer(&self, index: usize) -> Option<(Paint<'a>, PaintId)>
Returns the COLRv1 layer at the given index.
The second value in the tuple is a unique identifier for the paint that may be used to detect recursion in the paint graph.
Sourcepub fn v1_clip_box(&self, glyph_id: GlyphId) -> Option<ClipBox<'a>>
pub fn v1_clip_box(&self, glyph_id: GlyphId) -> Option<ClipBox<'a>>
Returns the COLRv1 clip box for the given glyph identifier.
Trait Implementations§
Source§impl<'a> Clone for ColrInstance<'a>
impl<'a> Clone for ColrInstance<'a>
Source§fn clone(&self) -> ColrInstance<'a>
fn clone(&self) -> ColrInstance<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more