#[repr(C)]pub enum SystemFontType {
Ui = 0,
UiBold = 1,
Monospace = 2,
MonospaceBold = 3,
MonospaceItalic = 4,
Title = 5,
TitleBold = 6,
Menu = 7,
Small = 8,
Serif = 9,
SerifBold = 10,
}Expand description
System font types that can be resolved at runtime based on OS settings.
This enum allows specifying semantic font roles that get resolved to
actual font families based on the current platform and user preferences.
For example, Monospace resolves to:
- macOS: SF Mono or Menlo
- Windows: Cascadia Mono or Consolas
- Linux: Ubuntu Mono or DejaVu Sans Mono
Font variants (bold, italic) can be combined with the base type.
Variants§
Ui = 0
UI font for buttons, labels, menus (SF Pro, Segoe UI, Cantarell)
UiBold = 1
Bold variant of UI font
Monospace = 2
Monospace font for code (SF Mono, Consolas, Ubuntu Mono)
MonospaceBold = 3
Bold variant of monospace font
MonospaceItalic = 4
Italic variant of monospace font
Title = 5
Font for window titles
TitleBold = 6
Bold variant of title font
Menu = 7
Font for menu items
Small = 8
Small/caption font
Serif = 9
Serif font for reading content (New York on macOS, Georgia on Windows)
SerifBold = 10
Bold variant of serif font
Implementations§
Source§impl SystemFontType
impl SystemFontType
Sourcepub fn from_css_str(s: &str) -> Option<Self>
pub fn from_css_str(s: &str) -> Option<Self>
Parse a SystemFontType from a CSS string.
Supported formats:
system:ui,system:ui:boldsystem:monospace,system:monospace:bold,system:monospace:italicsystem:title,system:title:boldsystem:menusystem:smallsystem:serif,system:serif:bold
Sourcepub fn as_css_str(&self) -> &'static str
pub fn as_css_str(&self) -> &'static str
Get the CSS syntax for this system font type.
Source§impl SystemFontType
impl SystemFontType
Sourcepub fn get_fallback_chain(&self, platform: &Platform) -> Vec<&'static str>
pub fn get_fallback_chain(&self, platform: &Platform) -> Vec<&'static str>
Returns the font fallback chain for this font type on the given platform.
The returned list contains font family names in order of preference. The first available font should be used.
Trait Implementations§
Source§impl Clone for SystemFontType
impl Clone for SystemFontType
Source§fn clone(&self) -> SystemFontType
fn clone(&self) -> SystemFontType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more