Skip to main content

GlyphSourceOrder

Struct GlyphSourceOrder 

Source
pub struct GlyphSourceOrder(u64);
Expand description

An ordered list of glyph sources, most preferred first.

Holds every source, four bits each, in eight bytes. It can be used as a constant and passed by value. A source listed more than once keeps only its first position.

How an order is used depends on the consumer:

  • Outlines use one base source per font. This is the first of Glyf, Cff2, Cff and Type1 that the font contains. If Varc comes before the base source, it applies to the glyphs it covers, and its components are drawn from the base source.
  • Bitmaps use the first of Sbix, Cbdt and Ebdt that the font contains.
  • Glyph extents try each source in the font, in order, until one provides extents for the glyph.

Tuple Fields§

§0: u64

Implementations§

Source§

impl GlyphSourceOrder

Source

pub const DEFAULT: Self

The default order for measuring glyphs: sbix, CBDT, COLR, VARC, glyf, CFF2, CFF, then Type 1 charstrings.

Color bitmaps come first, then color glyphs, then outlines with VARC before its base source. EBDT is not included, so monochrome and grayscale bitmaps are used only when a caller asks for them.

Source

pub const ALL: Self

Every source: sbix, CBDT, EBDT, COLR, VARC, glyf, CFF2, CFF, then Type 1 charstrings.

The order of DEFAULT, with EBDT after the color bitmaps.

Source

pub const OUTLINES: Self

The outline sources: VARC, glyf, CFF2, CFF, then Type 1 charstrings.

Source

pub const BASE_OUTLINES: Self

The outline sources without VARC: glyf, CFF2, CFF, then Type 1 charstrings.

Every glyph is drawn from the base source.

Source

pub const BITMAPS: Self

The bitmap sources: sbix, CBDT, then EBDT.

Source

pub const COLOR_BITMAPS: Self

The color bitmap sources: sbix, then CBDT.

Source

pub const MONO_BITMAPS: Self

The monochrome and grayscale bitmap source: EBDT.

Source

pub const COLOR: Self

The color glyph source: COLR.

Source

pub const EMPTY: Self

No sources.

Source

pub(crate) const MAX_LEN: usize

The most sources an order holds: each one at most once.

Source

pub const fn new(sources: &[GlyphSource]) -> Self

Creates an order from sources.

A source listed more than once keeps only its first position.

Source

pub const fn contains(self, source: GlyphSource) -> bool

Returns true if the order contains source.

Source

pub const fn is_empty(self) -> bool

Returns true if the order contains no sources.

Source

pub fn iter(self) -> impl Iterator<Item = GlyphSource>

Returns an iterator over the sources, most preferred first.

Trait Implementations§

Source§

impl Clone for GlyphSourceOrder

Source§

fn clone(&self) -> GlyphSourceOrder

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 Copy for GlyphSourceOrder

Source§

impl Debug for GlyphSourceOrder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for GlyphSourceOrder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for GlyphSourceOrder

Source§

impl Hash for GlyphSourceOrder

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for GlyphSourceOrder

Source§

fn eq(&self, other: &GlyphSourceOrder) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for GlyphSourceOrder

Auto Trait Implementations§

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.