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>
impl<'a> BaseInstance<'a>
Sourcepub fn new(base: Base<'a>) -> Self
pub fn new(base: Base<'a>) -> Self
Creates an instance that reads coordinates as the font stores them, with no deltas applied.
Sourcepub fn with_coords(base: Base<'a>, coords: &'a [F2Dot14]) -> Self
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.
Sourcepub fn baseline(
&self,
baseline_tag: Tag,
axis: BaseAxis,
script_tag: Tag,
) -> Option<F48Dot16>
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.
Sourcepub fn baseline_for_ppem(
&self,
baseline_tag: Tag,
axis: BaseAxis,
script_tag: Tag,
ppem: u16,
) -> Option<BaseValue>
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.
Sourcepub fn coord(&self, coord: &BaseCoord<'_>) -> F48Dot16
pub fn coord(&self, coord: &BaseCoord<'_>) -> F48Dot16
A coordinate in design units, with any variation delta applied.
Sourcepub fn coord_for_ppem(&self, coord: &BaseCoord<'_>, ppem: u16) -> BaseValue
pub fn coord_for_ppem(&self, coord: &BaseCoord<'_>, ppem: u16) -> BaseValue
A coordinate as read at a size.
fn delta(&self, index: DeltaSetIndex) -> Option<F48Dot16>
Methods from Deref<Target = Base<'a>>§
pub const MIN_SIZE: usize
Sourcepub fn resolve_offset<O: Offset, R: FontRead<'a, Args = ()>>(
&self,
offset: O,
) -> Result<R, ReadError>
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.
Sourcepub fn offset_data(&self) -> FontData<'a>
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.
Sourcepub fn shape(&self) -> &Self
👎Deprecated: just use the base type directly
pub fn shape(&self) -> &Self
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.
Sourcepub fn version(&self) -> MajorMinor
pub fn version(&self) -> MajorMinor
(major, minor) Version for the BASE table (1,0) or (1,1)
Sourcepub fn horiz_axis_offset(&self) -> Nullable<Offset16>
pub fn horiz_axis_offset(&self) -> Nullable<Offset16>
Offset to horizontal Axis table, from beginning of BASE table (may be NULL)
Sourcepub fn horiz_axis(&self) -> Option<Result<Axis<'a>, ReadError>>
pub fn horiz_axis(&self) -> Option<Result<Axis<'a>, ReadError>>
Attempt to resolve horiz_axis_offset.
Sourcepub fn vert_axis_offset(&self) -> Nullable<Offset16>
pub fn vert_axis_offset(&self) -> Nullable<Offset16>
Offset to vertical Axis table, from beginning of BASE table (may be NULL)
Sourcepub fn vert_axis(&self) -> Option<Result<Axis<'a>, ReadError>>
pub fn vert_axis(&self) -> Option<Result<Axis<'a>, ReadError>>
Attempt to resolve vert_axis_offset.
Sourcepub fn item_var_store_offset(&self) -> Option<Nullable<Offset32>>
pub fn item_var_store_offset(&self) -> Option<Nullable<Offset32>>
Offset to Item Variation Store table, from beginning of BASE table (may be null)
Sourcepub fn item_var_store(
&self,
) -> Option<Result<ItemVariationStore<'a>, ReadError>>
pub fn item_var_store( &self, ) -> Option<Result<ItemVariationStore<'a>, ReadError>>
Attempt to resolve item_var_store_offset.
pub fn version_byte_range(&self) -> Range<usize> ⓘ
pub fn horiz_axis_offset_byte_range(&self) -> Range<usize> ⓘ
pub fn vert_axis_offset_byte_range(&self) -> Range<usize> ⓘ
pub fn item_var_store_offset_byte_range(&self) -> Range<usize> ⓘ
Trait Implementations§
Source§impl<'a> Clone for BaseInstance<'a>
impl<'a> Clone for BaseInstance<'a>
Source§fn clone(&self) -> BaseInstance<'a>
fn clone(&self) -> BaseInstance<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more