pub enum Font {
}Expand description
A semantic (logical) text style. Each maps to the PLATFORM’s native text style where the toolkit
has one — UIFont/NSFont.preferredFont(forTextStyle:) on Apple (Dynamic Type), the
*TextBlockStyle resources on XAML — so a Day app matches the OS’s own typography and inherits its
accessibility text scaling for free. Backends without semantic styles (GTK/Qt/Android) approximate
with sizes that still track the platform’s text-scale / font-scale accessibility setting.
The set mirrors SwiftUI Font.TextStyle (largest → smallest).
Variants§
LargeTitle
Title
Title2
Title3
Headline
Subheadline
Body
Callout
Footnote
Caption
Caption2
System(f64)
A custom point size. Backends scale it by the platform’s accessibility text-scale (iOS via
UIFontMetrics, Android via sp, GTK via text-scaling-factor) so it stays legible.
Custom(&'static str, f64)
A bundled custom font by family name, at a point size (Font::Custom("Pacifico", 24.0)). The family must ship in the project’s fonts/ directory — day build stages the
file into each platform’s native font store and the backend registers it at startup
(§18.4). The name is the family name baked into the font file (what Font Book /
fontconfig report), not the file name. The size scales with the platform accessibility
text-scale exactly like Font::System; weight/italic apply only where the family ships
(or the platform synthesizes) such a face. An unknown family falls back to the system font
of the same size, with a warning in the log.
Implementations§
Source§impl Font
impl Font
Sourcepub const fn custom(family: FontFamily, size: f64) -> Font
pub const fn custom(family: FontFamily, size: f64) -> Font
A bundled custom font by typed family, at a point size — the checked form of
Font::Custom. Pass a generated res::fonts::… constant
(Font::custom(res::fonts::pacifico, 24.0)), which exists only if the family ships in the
project’s fonts/ directory, so the font is guaranteed bundled. For a family name known
another way, the untyped Font::Custom variant is the escape hatch.
Trait Implementations§
impl Copy for Font
impl StructuralPartialEq for Font
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§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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<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