pub struct FontVariation {
pub axis: String,
pub value: f64,
}Expand description
An axis tag and value that can be used to customize variable fonts.
Named constructors besides italic,
optical_size, slant,
width, and weight are
not added until a caller needs them.
Fields§
§axis: StringThe tag that identifies the design axis.
An axis tag must consist of 4 ASCII characters.
value: f64The value assigned to this design axis.
Implementations§
Source§impl FontVariation
impl FontVariation
Sourcepub fn new(axis: impl Into<String>, value: f64) -> FontVariation
pub fn new(axis: impl Into<String>, value: f64) -> FontVariation
Creates a FontVariation object, which can be added to a text style to
change the variable attributes of a font.
Sourcepub fn italic(value: f64) -> FontVariation
pub fn italic(value: f64) -> FontVariation
Variable font style. (ital)
Sourcepub fn optical_size(value: f64) -> FontVariation
pub fn optical_size(value: f64) -> FontVariation
Optical size optimization. (opsz)
Sourcepub fn slant(value: f64) -> FontVariation
pub fn slant(value: f64) -> FontVariation
Variable font slant. (slnt)
Sourcepub fn width(value: f64) -> FontVariation
pub fn width(value: f64) -> FontVariation
Variable font width. (wdth)
Sourcepub fn weight(value: f64) -> FontVariation
pub fn weight(value: f64) -> FontVariation
Variable font weight. (wght)
Sourcepub fn lerp(
a: Option<&FontVariation>,
b: Option<&FontVariation>,
t: f64,
) -> Option<FontVariation>
pub fn lerp( a: Option<&FontVariation>, b: Option<&FontVariation>, t: f64, ) -> Option<FontVariation>
Linearly interpolates between two font variations.
If the two variations have different axis tags, the interpolation switches abruptly from one to the other at t=0.5. Otherwise, the value is interpolated.