pub struct LocationRef<'a>(&'a [NormalizedCoord]);
Expand description
Reference to an ordered sequence of normalized variation coordinates.
To convert from user coordinates see crate::AxisCollection::location
.
This type represents a position in the variation space where each
coordinate corresponds to an axis (in the same order as the fvar
table)
and is a normalized value in the range [-1..1]
.
See Coordinate Scales and Normalization for further details.
If the array is larger in length than the number of axes, extraneous values are ignored. If it is smaller, unrepresented axes are assumed to be at their default positions (i.e. 0).
A value of this type constructed with default()
represents the default
position for each axis.
Normalized coordinates are ignored for non-variable fonts.
Tuple Fields§
§0: &'a [NormalizedCoord]
Implementations§
Source§impl<'a> LocationRef<'a>
impl<'a> LocationRef<'a>
Sourcepub fn new(coords: &'a [NormalizedCoord]) -> Self
pub fn new(coords: &'a [NormalizedCoord]) -> Self
Creates a new sequence of normalized coordinates from the given array.
Sourcepub fn coords(&self) -> &'a [NormalizedCoord] ⓘ
pub fn coords(&self) -> &'a [NormalizedCoord] ⓘ
Returns the underlying array of normalized coordinates.
Sourcepub fn is_default(&self) -> bool
pub fn is_default(&self) -> bool
Returns true if this represents the default location in variation space.
This is represented a set of normalized coordinates that is either empty or contains all zeroes.
Sourcepub(crate) fn effective_coords(&self) -> &'a [NormalizedCoord] ⓘ
pub(crate) fn effective_coords(&self) -> &'a [NormalizedCoord] ⓘ
Returns the underlying coordinate array if any of the entries are non-zero. Otherwise returns the empty slice.
This allows internal routines to bypass expensive variation code paths by just checking for an empty slice.
Trait Implementations§
Source§impl<'a> Clone for LocationRef<'a>
impl<'a> Clone for LocationRef<'a>
Source§fn clone(&self) -> LocationRef<'a>
fn clone(&self) -> LocationRef<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more