pub struct FontFamily(/* private fields */);
Expand description
A reference to a font family.
This may be either a CSS-style “generic family name”, such as “serif” or “monospace”, or it can be an explicit family name.
To use a generic family name, use the provided associated constants:
FontFamily::SERIF
, FontFamily::SANS_SERIF
, FontFamily::SYSTEM_UI
,
and FontFamily::MONOSPACE
.
To use a specific font family you should not construct this type directly;
instead you should verify that the desired family exists, via the
Text::font_family
API.
Implementations§
Source§impl FontFamily
impl FontFamily
Sourcepub const SANS_SERIF: FontFamily
pub const SANS_SERIF: FontFamily
A san-serif font, such as Arial or Helvetica.
Sourcepub const SERIF: FontFamily
pub const SERIF: FontFamily
A serif font, such as Times New Roman or Charter.
Sourcepub const SYSTEM_UI: FontFamily
pub const SYSTEM_UI: FontFamily
The platform’s preferred UI font; San Francisco on macOS, and Segoe UI on recent Windows.
Sourcepub const MONOSPACE: FontFamily
pub const MONOSPACE: FontFamily
A monospace font.
Sourcepub fn new_unchecked(s: impl Into<Arc<str>>) -> FontFamily
pub fn new_unchecked(s: impl Into<Arc<str>>) -> FontFamily
Create a new font family with a given name, without verifying that it exists.
This should generally not be used; instead you should create a FontFamily
by calling the Text::font_family
method, which verifies that the
family name exists.
Sourcepub fn is_generic(&self) -> bool
pub fn is_generic(&self) -> bool
Returns true
if this is a generic font family.
Trait Implementations§
Source§impl Clone for FontFamily
impl Clone for FontFamily
Source§fn clone(&self) -> FontFamily
fn clone(&self) -> FontFamily
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more