pub struct Designspace {
pub format: f32,
pub axes: Axes,
pub sources: Sources,
pub instances: Option<Instances>,
}
Expand description
A designspace object
Fields§
§format: f32
The format of this designspace file (we support 2 and 3)
axes: Axes
An axes element (contains individual axes)
sources: Sources
An sources element (contains individual sources)
instances: Option<Instances>
An instance element (optional, contains individual instances)
Implementations§
Source§impl Designspace
impl Designspace
Sourcepub fn add_to_font(&self, font: &mut Font) -> Result<(), &'static str>
pub fn add_to_font(&self, font: &mut Font) -> Result<(), &'static str>
Add information to a fonttools Font object (fvar and avar tables) expressed by this design space.
Sourcepub fn tag_to_name(&self) -> HashMap<Tag, String>
pub fn tag_to_name(&self) -> HashMap<Tag, String>
Returns a mapping between axis tags and their names
Sourcepub fn axis_order(&self) -> Vec<Tag> ⓘ
pub fn axis_order(&self) -> Vec<Tag> ⓘ
Returns the axis order. Requires the tags to be validated; will panic if they are not four-byte tags.
Sourcepub fn default_location(&self) -> Vec<i32>
pub fn default_location(&self) -> Vec<i32>
Returns the default master location in userspace coordinates
Sourcepub fn default_designspace_location(&self) -> Vec<i32>
pub fn default_designspace_location(&self) -> Vec<i32>
Returns the default master location in designspace coordinates
Sourcepub fn source_location(&self, source: &Source) -> Vec<i32>
pub fn source_location(&self, source: &Source) -> Vec<i32>
Returns the location of a given source object in design space coordinates
Sourcepub fn location_to_tuple(&self, loc: &Location) -> Vec<f32>
pub fn location_to_tuple(&self, loc: &Location) -> Vec<f32>
Converts a location to a tuple
Sourcepub fn default_master(&self) -> Option<&Source>
pub fn default_master(&self) -> Option<&Source>
Returns the Source object for the master at default axis coordinates, if one can be found
Sourcepub fn normalize_location(&self, loc: Vec<i32>) -> NormalizedLocation
pub fn normalize_location(&self, loc: Vec<i32>) -> NormalizedLocation
Normalizes a location between -1.0 and 1.0
Sourcepub fn variation_model(&self) -> VariationModel
pub fn variation_model(&self) -> VariationModel
Constructs a fonttools variation model for this designspace
Trait Implementations§
Source§impl Debug for Designspace
impl Debug for Designspace
Source§impl<'de> Deserialize<'de> for Designspace
impl<'de> Deserialize<'de> for Designspace
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Designspace
impl RefUnwindSafe for Designspace
impl Send for Designspace
impl Sync for Designspace
impl Unpin for Designspace
impl UnwindSafe for Designspace
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more