Skip to main content

ValueRecord

Struct ValueRecord 

Source
pub struct ValueRecord<'a> {
    data: FontData<'a>,
    offset: u32,
    format: ValueFormat,
}
Expand description

A GPOS ValueRecord, with fields read on demand.

The contents of a value record are described by a ValueFormat stored in the parent table, so a record cannot be located or interpreted on its own. This type stores the position of the record within its parent table’s data alongside that format, and reads individual fields only when they are asked for; constructing one performs no reads at all.

Fields§

§data: FontData<'a>

The offset data of the table containing the record.

§offset: u32

The position of the record within data.

§format: ValueFormat

Implementations§

Source§

impl<'a> ValueRecord<'a>

Source

pub fn new(data: FontData<'a>, offset: usize, format: ValueFormat) -> Self

Creates a value record positioned at offset within data.

data must be the offset data of the table containing the record, and not merely the bytes of the record itself: the device and variation index offsets in a value record are resolved relative to that table.

Source

pub fn format(&self) -> ValueFormat

The format describing which fields this record contains.

Source

pub fn byte_len(&self) -> usize

The number of bytes occupied by this record.

Source

pub fn is_empty(&self) -> bool

Returns true if this record contains no fields.

Source

pub fn offset_data(&self) -> FontData<'a>

The offset data of the table containing this record.

Source

pub fn offset(&self) -> usize

The position of this record within offset_data.

Source

pub fn x_placement(&self) -> Option<i16>

Source

pub fn y_placement(&self) -> Option<i16>

Source

pub fn x_advance(&self) -> Option<i16>

Source

pub fn y_advance(&self) -> Option<i16>

Source

pub fn x_placement_device( &self, ) -> Option<Result<DeviceOrVariationIndex<'a>, ReadError>>

Source

pub fn y_placement_device( &self, ) -> Option<Result<DeviceOrVariationIndex<'a>, ReadError>>

Source

pub fn x_advance_device( &self, ) -> Option<Result<DeviceOrVariationIndex<'a>, ReadError>>

Source

pub fn y_advance_device( &self, ) -> Option<Result<DeviceOrVariationIndex<'a>, ReadError>>

Source

pub fn device_offset(&self, field: ValueFormat) -> Option<Nullable<Offset16>>

Returns the raw, unresolved offset for the given device field.

The returned offset is relative to offset_data. Returns None if the field is not present in this record’s format, or if the record is truncated.

Source

pub fn bytes(&self) -> Option<&'a [u8]>

The raw bytes of this record, or None if the data is truncated.

Source

fn field_offset(&self, field: ValueFormat) -> Option<usize>

Returns the position of field within offset_data, or None if this record’s format doesn’t include it.

Fields are laid out in the order of their format bits and each occupies two bytes, so a field’s position is fixed by the number of lower format bits that are set.

Source

fn read_i16(&self, field: ValueFormat) -> Option<i16>

Source

fn read_device( &self, field: ValueFormat, ) -> Option<Result<DeviceOrVariationIndex<'a>, ReadError>>

Trait Implementations§

Source§

impl<'a> Clone for ValueRecord<'a>

Source§

fn clone(&self) -> ValueRecord<'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 ComputeSize for ValueRecord<'_>

Source§

fn compute_size(args: ValueFormat) -> Result<usize, ReadError>

Compute the number of bytes required to represent this type.
Source§

impl<'a> Copy for ValueRecord<'a>

Source§

impl Debug for ValueRecord<'_>

Source§

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

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

impl<'a> Default for ValueRecord<'a>

Source§

fn default() -> ValueRecord<'a>

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

impl Eq for ValueRecord<'_>

Source§

impl<'a> FontReadAt<'a> for ValueRecord<'a>

Source§

fn read_at( data: FontData<'a>, offset: usize, args: ValueFormat, ) -> Result<Self, ReadError>

Read an item positioned at offset bytes into data.
Source§

impl PartialEq for ValueRecord<'_>

Two records are equal when they describe the same positioning: same format, and the same bytes for the fields that format selects.

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl ReadArgs for ValueRecord<'_>

Auto Trait Implementations§

§

impl<'a> Freeze for ValueRecord<'a>

§

impl<'a> RefUnwindSafe for ValueRecord<'a>

§

impl<'a> Send for ValueRecord<'a>

§

impl<'a> Sync for ValueRecord<'a>

§

impl<'a> Unpin for ValueRecord<'a>

§

impl<'a> UnsafeUnpin for ValueRecord<'a>

§

impl<'a> UnwindSafe for ValueRecord<'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.