pub struct Axis {
pub name: String,
pub tag: Tag,
pub min: UserCoord,
pub default: UserCoord,
pub max: UserCoord,
pub hidden: bool,
pub converter: CoordConverter,
pub localized_names: HashMap<String, String>,
}Expand description
A variable font axis.
Fields§
§name: StringA human-readable name, like ‘Weight’.
tag: TagThe axis tag, like ‘wght’.
min: UserCoordThe minimum value for this axis, in UserSpace.
default: UserCoordThe default value for this axis, in UserSpace.
max: UserCoordThe max value for this axis, in UserSpace.
converter: CoordConverter§localized_names: HashMap<String, String>Localized names for the axis, e.g. {"en": "Weight"}
Implementations§
Source§impl Axis
impl Axis
pub fn is_point(&self) -> bool
Sourcepub fn default_converter(&self) -> CoordConverter
pub fn default_converter(&self) -> CoordConverter
Initialize a CoordConverter for the default normalization from this axis user space.
Sourcepub fn ui_label_name(&self) -> &str
pub fn ui_label_name(&self) -> &str
Display name for the axis.
Some frontends (e.g. designspace) support the notion of an axis’ UI label name distinct
from the axis name; the former is used for displaying the axis in UI and can be
localised, whereas the latter is only used for internal cross-references.
In Designspace documents, these are stored in the axes’ <labelname> elements.
FontTools uses these to build the name records associated with axis names referenced
by fvar and STAT tables, or else falls back to the axis.name.
But even when the labelnames are ommited, there’s a special group of registered
axis names that were common in old MutatorMath source files before the <labelname>
element itself got standardised, which continue to receive a special treatment in
fonttools: i.e., the lowercase, shortened name gets replaced with a title-case,
expanded one (e.g. ‘weight’ => ‘Weight’, ‘optical’ => ‘Optical Size’ etc.).
For the sake of matching fontmake (which uses fonttools), we do the same here.
For additional info see: https://github.com/googlefonts/fontc/issues/1020
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Axis
impl<'de> Deserialize<'de> for Axis
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>,
Source§impl FromIterator<Axis> for Axes
impl FromIterator<Axis> for Axes
impl Eq for Axis
impl StructuralPartialEq for Axis
Auto Trait Implementations§
impl Freeze for Axis
impl RefUnwindSafe for Axis
impl Send for Axis
impl Sync for Axis
impl Unpin for Axis
impl UnwindSafe for Axis
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.