Struct ttf_parser::colr::Table
source · pub struct Table<'a> {Show 13 fields
pub(crate) palettes: Table<'a>,
data: &'a [u8],
version: u8,
base_glyphs: LazyArray16<'a, BaseGlyphRecord>,
layers: LazyArray16<'a, LayerRecord>,
base_glyph_paints_offset: Offset32,
base_glyph_paints: LazyArray32<'a, BaseGlyphPaintRecord>,
layer_paint_offsets_offset: Offset32,
layer_paint_offsets: LazyArray32<'a, Offset32>,
clip_list_offsets_offset: Offset32,
clip_list: ClipList<'a>,
var_index_map: Option<DeltaSetIndexMap<'a>>,
item_variation_store: Option<ItemVariationStore<'a>>,
}
Expand description
A Color Table.
Currently, only version 0 is supported.
Fields§
§palettes: Table<'a>
§data: &'a [u8]
§version: u8
§base_glyphs: LazyArray16<'a, BaseGlyphRecord>
§layers: LazyArray16<'a, LayerRecord>
§base_glyph_paints_offset: Offset32
§base_glyph_paints: LazyArray32<'a, BaseGlyphPaintRecord>
§layer_paint_offsets_offset: Offset32
§layer_paint_offsets: LazyArray32<'a, Offset32>
§clip_list_offsets_offset: Offset32
§clip_list: ClipList<'a>
§var_index_map: Option<DeltaSetIndexMap<'a>>
§item_variation_store: Option<ItemVariationStore<'a>>
Implementations§
source§impl<'a> Table<'a>
impl<'a> Table<'a>
sourcepub fn parse(palettes: Table<'a>, data: &'a [u8]) -> Option<Self>
pub fn parse(palettes: Table<'a>, data: &'a [u8]) -> Option<Self>
Parses a table from raw data.
sourcepub fn is_simple(&self) -> bool
pub fn is_simple(&self) -> bool
Returns true
if the current table has version 0.
A simple table can only emit outline_glyph
and paint
Painter
methods.
fn get_v0(&self, glyph_id: GlyphId) -> Option<BaseGlyphRecord>
fn get_v1(&self, glyph_id: GlyphId) -> Option<BaseGlyphPaintRecord>
fn variation_data(&self) -> VariationData<'a>
sourcepub fn contains(&self, glyph_id: GlyphId) -> bool
pub fn contains(&self, glyph_id: GlyphId) -> bool
Whether the table contains a definition for the given glyph.
sourcepub fn clip_box(
&self,
glyph_id: GlyphId,
coords: &[NormalizedCoordinate],
) -> Option<ClipBox>
pub fn clip_box( &self, glyph_id: GlyphId, coords: &[NormalizedCoordinate], ) -> Option<ClipBox>
Returns the clip box for a glyph.
sourcepub fn paint(
&self,
glyph_id: GlyphId,
palette: u16,
painter: &mut dyn Painter<'a>,
coords: &[NormalizedCoordinate],
foreground_color: RgbaColor,
) -> Option<()>
pub fn paint( &self, glyph_id: GlyphId, palette: u16, painter: &mut dyn Painter<'a>, coords: &[NormalizedCoordinate], foreground_color: RgbaColor, ) -> Option<()>
Paints the color glyph.
fn paint_impl( &self, glyph_id: GlyphId, palette: u16, painter: &mut dyn Painter<'a>, recusion_stack: &mut RecursionStack, coords: &[NormalizedCoordinate], foreground_color: RgbaColor, ) -> Option<()>
fn paint_v0( &self, base: BaseGlyphRecord, palette: u16, painter: &mut dyn Painter<'_>, foreground_color: RgbaColor, ) -> Option<()>
fn paint_v1( &self, base: BaseGlyphPaintRecord, palette: u16, painter: &mut dyn Painter<'a>, recursion_stack: &mut RecursionStack, coords: &[NormalizedCoordinate], foreground_color: RgbaColor, ) -> Option<()>
fn parse_paint( &self, offset: usize, palette: u16, painter: &mut dyn Painter<'a>, recursion_stack: &mut RecursionStack, coords: &[NormalizedCoordinate], foreground_color: RgbaColor, ) -> Option<()>
fn parse_paint_impl( &self, offset: usize, palette: u16, painter: &mut dyn Painter<'a>, recursion_stack: &mut RecursionStack, s: &mut Stream<'_>, format: u8, coords: &[NormalizedCoordinate], foreground_color: RgbaColor, ) -> Option<()>
fn parse_color_line( &self, offset: usize, foreground_color: RgbaColor, ) -> Option<NonVarColorLine<'a>>
fn parse_var_color_line( &self, offset: usize, foreground_color: RgbaColor, ) -> Option<VarColorLine<'a>>
Trait Implementations§
impl<'a> Copy for Table<'a>
Auto Trait Implementations§
impl<'a> Freeze for Table<'a>
impl<'a> RefUnwindSafe for Table<'a>
impl<'a> Send for Table<'a>
impl<'a> Sync for Table<'a>
impl<'a> Unpin for Table<'a>
impl<'a> UnwindSafe for Table<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more