pub enum Font {
Web(String, String, FontStyle, FontWeight),
}Expand description
Describes a font available to native text renderers.
Pax templates may use either the explicit Font::Web constructor or a
contextual shorthand. A string names a locally available family with an
empty source URL and normal style and weight:
font: "Times New Roman"Named object fields describe font sources and optional modifiers. Omitted
fields retain their defaults. Supplying family without url selects a
locally available family, matching the string shorthand. weight accepts
either FontWeight or its CSS numeric equivalent from 100 through
900:
font: {
family: "Inter"
url: "https://example.com/Inter-Italic.ttf"
style: FontStyle::Italic
weight: 700
}Nonempty URLs identify font files, except that Google Fonts URLs containing
fonts.googleapis.com/css receive special stylesheet handling. Relative
asset URLs work on web; the native Web-font loader does not resolve them
into application bundle resources. Native targets also require the actual
font family name, rather than a browser-only alias.
Font shorthand has no positional (“magic index”) fields: named keys are
canonical, and positional list/tuple forms are not accepted. Use the
explicit Font::Web constructor as verbose longhand when needed.
Variants§
Web(String, String, FontStyle, FontWeight)
Font described by family name, source URL, style, and weight.
Trait Implementations§
Source§impl CoercionRules for Font
impl CoercionRules for Font
Source§impl<'de> Deserialize<'de> for Font
impl<'de> Deserialize<'de> for Font
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 HelperFunctions for Font
impl HelperFunctions for Font
Source§fn register_all_functions()
fn register_all_functions()
impl ImplToFromPaxAny for Font
Source§impl Interpolatable for Font
impl Interpolatable for Font
Source§fn interpolate(&self, _other: &Self, _t: f64) -> Self
fn interpolate(&self, _other: &Self, _t: f64) -> Self
Source§impl ToPaxValue for Font
impl ToPaxValue for Font
Source§fn to_pax_value(self) -> PaxValue
fn to_pax_value(self) -> PaxValue
PaxValue.Auto Trait Implementations§
impl Freeze for Font
impl RefUnwindSafe for Font
impl Send for Font
impl Sync for Font
impl Unpin for Font
impl UnsafeUnpin for Font
impl UnwindSafe for Font
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> PropertyValue for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
Source§fn round_into(self) -> U
fn round_into(self) -> U
Source§impl<T> ToFromPaxAny for Twhere
T: ImplToFromPaxAny,
impl<T> ToFromPaxAny for Twhere
T: ImplToFromPaxAny,
Source§fn to_pax_any(self) -> PaxAny
fn to_pax_any(self) -> PaxAny
PaxAny.Source§fn from_pax_any(pax_any: PaxAny) -> Result<T, String>
fn from_pax_any(pax_any: PaxAny) -> Result<T, String>
PaxAny.