Skip to main content

TupleVariationData

Struct TupleVariationData 

Source
pub struct TupleVariationData<'a, T> {
    pub(crate) axis_count: u16,
    pub(crate) shared_tuples: Option<ComputedArray<'a, Tuple<'a>>>,
    pub(crate) shared_point_numbers: Option<PackedPointNumbers<'a>>,
    pub(crate) tuple_count: TupleVariationCount,
    pub(crate) header_data: FontData<'a>,
    pub(crate) serialized_data: FontData<'a>,
    pub(crate) _marker: PhantomData<fn() -> T>,
}

Fields§

§axis_count: u16§shared_tuples: Option<ComputedArray<'a, Tuple<'a>>>§shared_point_numbers: Option<PackedPointNumbers<'a>>§tuple_count: TupleVariationCount§header_data: FontData<'a>§serialized_data: FontData<'a>§_marker: PhantomData<fn() -> T>

Implementations§

Source§

impl TupleVariationData<'_, GlyphDelta>

Source

pub fn simple_deltas<C, D>( &self, coords: &[F2Dot14], points: &[Point<C>], flags: &mut [PointFlags], contours: &[u16], buffers: &mut DeltaBuffers<'_, D>, ) -> Result<(), ReadError>
where C: PointCoord, D: PointCoord + From<C>,

Computes the deltas for the points of a simple glyph at the given location in variation space.

Deltas for points that a sparse tuple does not reference are inferred by interpolation, so this needs the glyph’s points and contour end points in addition to the buffers it writes.

  • points and contours describe the unvaried glyph. points must include the four phantom points.
  • flags is used as scratch: the PointMarker::HAS_DELTA marker is cleared and set as tuples are processed.
  • buffers supplies the output and interpolation storage.

flags and both buffers must be at least as long as points, which is what everything here is indexed by.

The deltas are zeroed before anything else happens, so they never retain values from a previous call.

See Gvar::simple_deltas to look a glyph’s data up first.

Source

pub fn composite_deltas<D: PointCoord>( &self, coords: &[F2Dot14], deltas: &mut [Point<D>], ) -> Result<(), ReadError>

Computes the deltas for the component offsets of a composite glyph at the given location in variation space.

Interpolation is meaningless for component offsets, so this skips the expensive part of Self::simple_deltas and needs no scratch.

deltas must have one entry per component plus four for the phantom points, and is zeroed first.

See Gvar::composite_deltas to look a glyph’s data up first.

Source

fn accumulate_deltas<D: PointCoord>( &self, coords: &[F2Dot14], deltas: &mut [Point<D>], apply_sparse_tuple: impl FnMut(Fixed, TupleVariation<'_, GlyphDelta>, &mut [Point<D>]) -> Result<(), ReadError>, ) -> Result<(), ReadError>

The parts shared by simple and composite glyph processing.

Zeroes deltas, then accumulates every tuple that is active at coords. Dense tuples are handled here; sparse tuples are passed to apply_sparse_tuple, which differs between the two glyph kinds.

Source§

impl<'a> TupleVariationData<'a, GlyphDelta>

Source

pub(crate) fn new( data: FontData<'a>, axis_count: u16, shared_tuples: SharedTuples<'a>, ) -> Result<Self, ReadError>

Source§

impl<'a, T> TupleVariationData<'a, T>
where T: TupleDelta,

Source

pub fn tuples(&self) -> TupleVariationIter<'a, T>

Source

pub fn active_tuples_at<'b>( &self, coords: &'b [F2Dot14], ) -> impl Iterator<Item = (TupleVariation<'a, T>, Fixed)> + 'b
where 'a: 'b,

Returns an iterator over all of the pairs of (variation tuple, scalar) for this glyph that are active for the given set of normalized coordinates.

Source

pub(crate) fn tuple_count(&self) -> usize

Trait Implementations§

Source§

impl<'a, T: Clone> Clone for TupleVariationData<'a, T>

Source§

fn clone(&self) -> TupleVariationData<'a, T>

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

Auto Trait Implementations§

§

impl<'a, T> Freeze for TupleVariationData<'a, T>

§

impl<'a, T> RefUnwindSafe for TupleVariationData<'a, T>

§

impl<'a, T> Send for TupleVariationData<'a, T>

§

impl<'a, T> Sync for TupleVariationData<'a, T>

§

impl<'a, T> Unpin for TupleVariationData<'a, T>

§

impl<'a, T> UnsafeUnpin for TupleVariationData<'a, T>

§

impl<'a, T> UnwindSafe for TupleVariationData<'a, T>

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> 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.