Skip to main content

BaseInstance

Struct BaseInstance 

Source
pub struct BaseInstance<'a> {
    base: Base<'a>,
    var_store: Option<ItemVariationStore<'a>>,
    coords: &'a [F2Dot14],
}
Expand description

A BASE table paired with a location in variation space.

The table carries its own item variation store, so an instance needs only the coordinates to read at; without them it reads the values as the font stores them.

Fields§

§base: Base<'a>§var_store: Option<ItemVariationStore<'a>>§coords: &'a [F2Dot14]

Implementations§

Source§

impl<'a> BaseInstance<'a>

Source

pub fn new(base: Base<'a>) -> Self

Creates an instance that reads coordinates as the font stores them, with no deltas applied.

Source

pub fn with_coords(base: Base<'a>, coords: &'a [F2Dot14]) -> Self

Creates an instance that reads coordinates at coords.

Deltas are applied only when the table has an item variation store and coords is not empty; without either this behaves as new.

Source

pub fn baseline( &self, baseline_tag: Tag, axis: BaseAxis, script_tag: Tag, ) -> Option<F48Dot16>

The position of one baseline, in design units, or None where the font does not place it.

A baseline is a position on the axis across the writing direction: a y coordinate for horizontal text, an x coordinate for vertical text.

Source

pub fn baseline_for_ppem( &self, baseline_tag: Tag, axis: BaseAxis, script_tag: Tag, ppem: u16, ) -> Option<BaseValue>

The position of one baseline as read at a size, or None where the font does not place it.

ppem is the size along the same axis the coordinate lies on, so it is the vertical size for horizontal text and the horizontal size for vertical text.

Source

pub fn coord(&self, coord: &BaseCoord<'_>) -> F48Dot16

A coordinate in design units, with any variation delta applied.

Source

pub fn coord_for_ppem(&self, coord: &BaseCoord<'_>, ppem: u16) -> BaseValue

A coordinate as read at a size.

Source

fn delta(&self, index: DeltaSetIndex) -> Option<F48Dot16>

Methods from Deref<Target = Base<'a>>§

Source

pub const MIN_SIZE: usize

Source

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.

Source

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.

Source

pub fn shape(&self) -> &Self

👎Deprecated:

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.

Source

pub fn version(&self) -> MajorMinor

(major, minor) Version for the BASE table (1,0) or (1,1)

Source

pub fn horiz_axis_offset(&self) -> Nullable<Offset16>

Offset to horizontal Axis table, from beginning of BASE table (may be NULL)

Source

pub fn horiz_axis(&self) -> Option<Result<Axis<'a>, ReadError>>

Attempt to resolve horiz_axis_offset.

Source

pub fn vert_axis_offset(&self) -> Nullable<Offset16>

Offset to vertical Axis table, from beginning of BASE table (may be NULL)

Source

pub fn vert_axis(&self) -> Option<Result<Axis<'a>, ReadError>>

Attempt to resolve vert_axis_offset.

Source

pub fn item_var_store_offset(&self) -> Option<Nullable<Offset32>>

Offset to Item Variation Store table, from beginning of BASE table (may be null)

Source

pub fn item_var_store( &self, ) -> Option<Result<ItemVariationStore<'a>, ReadError>>

Attempt to resolve item_var_store_offset.

Source

pub fn version_byte_range(&self) -> Range<usize> ⓘ

Source

pub fn horiz_axis_offset_byte_range(&self) -> Range<usize> ⓘ

Source

pub fn vert_axis_offset_byte_range(&self) -> Range<usize> ⓘ

Source

pub fn item_var_store_offset_byte_range(&self) -> Range<usize> ⓘ

Source

pub fn axis(&self, axis: BaseAxis) -> Option<Axis<'a>>

The axis table for a writing direction, or None where the font describes no baselines for that direction.

Trait Implementations§

Source§

impl<'a> Clone for BaseInstance<'a>

Source§

fn clone(&self) -> BaseInstance<'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> Deref for BaseInstance<'a>

Source§

type Target = Base<'a>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<'a> Freeze for BaseInstance<'a>

§

impl<'a> RefUnwindSafe for BaseInstance<'a>

§

impl<'a> Send for BaseInstance<'a>

§

impl<'a> Sync for BaseInstance<'a>

§

impl<'a> Unpin for BaseInstance<'a>

§

impl<'a> UnsafeUnpin for BaseInstance<'a>

§

impl<'a> UnwindSafe for BaseInstance<'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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.