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. Apple chassis register TTF/OTF files from the project’s
assets/ directory at startup; select their actual family name with an empty
URL, or use that family with the web asset URL in a shared declaration. The
native Web-font loader itself does not resolve relative URLs into bundle
resources. Browser-only aliases do not name the registered Apple family.
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§fn allows_singleton_stack() -> bool
fn allows_singleton_stack() -> bool
Source§fn is_identity_roundtrip() -> bool
fn is_identity_roundtrip() -> bool
Self preserves the semantics of converting that clone
through ToPaxValue and back with try_coerce. Read moreSource§impl<'de> Deserialize<'de> for Font
impl<'de> Deserialize<'de> for Font
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Font, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Font, <__D as Deserializer<'de>>::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 Serialize for Font
impl Serialize for Font
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl ToPaxValue for Font
impl ToPaxValue for Font
Source§fn to_pax_value(self) -> PaxValue
fn to_pax_value(self) -> PaxValue
PaxValue.Source§fn nested_properties(&self) -> Vec<UntypedProperty>
fn nested_properties(&self) -> Vec<UntypedProperty>
Source§fn to_pax_value_in_graph(self) -> PaxValuewhere
Self: Sized,
fn to_pax_value_in_graph(self) -> PaxValuewhere
Self: Sized,
Self::to_pax_value reads published value snapshots.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.