Skip to main content

ColorGlyphs

Struct ColorGlyphs 

Source
pub struct ColorGlyphs<'a> {
    font: &'a Font,
    tables: Option<&'a ColrTables<'a>>,
}
Expand description

Provides access to the color glyphs in a font.

Glyphs are painted at the location of the font. This type is cheap to create and copy because it borrows tables that the font has already parsed.

Fields§

§font: &'a Font§tables: Option<&'a ColrTables<'a>>

Implementations§

Source§

impl<'a> ColorGlyphs<'a>

Source

pub(crate) fn new(font: &'a Font) -> Self

Source

pub fn font(&self) -> &'a Font

Returns the font that contains these glyphs.

Source

pub fn is_empty(&self) -> bool

Returns true if the font has no COLR table.

Source

pub fn version(&self) -> Option<u16>

Returns the version of the COLR table, or None if the font has no COLR table.

Source

pub fn get_with_version( &self, glyph: GlyphId, version: ColorGlyphVersion, ) -> Option<ColorGlyph<'a>>

Returns the color glyph for glyph painted with the given version of COLR, if the table has one.

Source

pub fn get(&self, glyph: GlyphId) -> Option<ColorGlyph<'a>>

Returns the color glyph for glyph.

Uses version 1 of the table if it has the glyph, and version 0 otherwise.

Source

pub(crate) fn extents( &self, glyph: GlyphId, outlines: OutlineGlyphs<'a>, ) -> Option<GlyphExtents<f32>>

Returns the ink bounds of glyph in font units, measured as HarfBuzz measures a color glyph.

Uses the clip box of a version 1 glyph if it has one. Otherwise the glyph is painted, from either version, and its fills are measured. Returns None if the table has no color glyph for glyph or painting it fails. A fill clipped to an outline measures the outline in outlines.

Source

fn instance(&self) -> Option<ColrInstance<'a>>

Trait Implementations§

Source§

impl<'a> Clone for ColorGlyphs<'a>

Source§

fn clone(&self) -> ColorGlyphs<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for ColorGlyphs<'a>

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for ColorGlyphs<'a>

§

impl<'a> !UnwindSafe for ColorGlyphs<'a>

§

impl<'a> Freeze for ColorGlyphs<'a>

§

impl<'a> Send for ColorGlyphs<'a>

§

impl<'a> Sync for ColorGlyphs<'a>

§

impl<'a> Unpin for ColorGlyphs<'a>

§

impl<'a> UnsafeUnpin for ColorGlyphs<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.