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: u32The position of the record within data.
format: ValueFormatImplementations§
Source§impl<'a> ValueRecord<'a>
impl<'a> ValueRecord<'a>
Sourcepub fn new(data: FontData<'a>, offset: usize, format: ValueFormat) -> Self
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.
Sourcepub fn format(&self) -> ValueFormat
pub fn format(&self) -> ValueFormat
The format describing which fields this record contains.
Sourcepub fn offset_data(&self) -> FontData<'a>
pub fn offset_data(&self) -> FontData<'a>
The offset data of the table containing this record.
Sourcepub fn offset(&self) -> usize
pub fn offset(&self) -> usize
The position of this record within offset_data.
pub fn x_placement(&self) -> Option<i16>
pub fn y_placement(&self) -> Option<i16>
pub fn x_advance(&self) -> Option<i16>
pub fn y_advance(&self) -> Option<i16>
pub fn x_placement_device( &self, ) -> Option<Result<DeviceOrVariationIndex<'a>, ReadError>>
pub fn y_placement_device( &self, ) -> Option<Result<DeviceOrVariationIndex<'a>, ReadError>>
pub fn x_advance_device( &self, ) -> Option<Result<DeviceOrVariationIndex<'a>, ReadError>>
pub fn y_advance_device( &self, ) -> Option<Result<DeviceOrVariationIndex<'a>, ReadError>>
Sourcepub fn device_offset(&self, field: ValueFormat) -> Option<Nullable<Offset16>>
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.
Sourcepub fn bytes(&self) -> Option<&'a [u8]>
pub fn bytes(&self) -> Option<&'a [u8]>
The raw bytes of this record, or None if the data is truncated.
Sourcefn field_offset(&self, field: ValueFormat) -> Option<usize>
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.
fn read_i16(&self, field: ValueFormat) -> Option<i16>
fn read_device( &self, field: ValueFormat, ) -> Option<Result<DeviceOrVariationIndex<'a>, ReadError>>
Trait Implementations§
Source§impl<'a> Clone for ValueRecord<'a>
impl<'a> Clone for ValueRecord<'a>
Source§fn clone(&self) -> ValueRecord<'a>
fn clone(&self) -> ValueRecord<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl ComputeSize for ValueRecord<'_>
impl ComputeSize for ValueRecord<'_>
Source§fn compute_size(args: ValueFormat) -> Result<usize, ReadError>
fn compute_size(args: ValueFormat) -> Result<usize, ReadError>
impl<'a> Copy for ValueRecord<'a>
Source§impl Debug for ValueRecord<'_>
impl Debug for ValueRecord<'_>
Source§impl<'a> Default for ValueRecord<'a>
impl<'a> Default for ValueRecord<'a>
Source§fn default() -> ValueRecord<'a>
fn default() -> ValueRecord<'a>
impl Eq for ValueRecord<'_>
Source§impl<'a> FontReadAt<'a> for ValueRecord<'a>
impl<'a> FontReadAt<'a> for ValueRecord<'a>
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.
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.