Struct piet_common::FontFamily
source · pub struct FontFamily(_);
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 = FontFamily(FontFamilyInner::SansSerif)
pub const SANS_SERIF: FontFamily = FontFamily(FontFamilyInner::SansSerif)
A san-serif font, such as Arial or Helvetica.
sourcepub const SERIF: FontFamily = FontFamily(FontFamilyInner::Serif)
pub const SERIF: FontFamily = FontFamily(FontFamilyInner::Serif)
A serif font, such as Times New Roman or Charter.
sourcepub const SYSTEM_UI: FontFamily = FontFamily(FontFamilyInner::SystemUi)
pub const SYSTEM_UI: FontFamily = FontFamily(FontFamilyInner::SystemUi)
The platform’s preferred UI font; San Francisco on macOS, and Segoe UI on recent Windows.
sourcepub const MONOSPACE: FontFamily = FontFamily(FontFamilyInner::Monospace)
pub const MONOSPACE: FontFamily = FontFamily(FontFamilyInner::Monospace)
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 moresource§impl Debug for FontFamily
impl Debug for FontFamily
source§impl Default for FontFamily
impl Default for FontFamily
source§fn default() -> FontFamily
fn default() -> FontFamily
source§impl From<FontFamily> for TextAttribute
impl From<FontFamily> for TextAttribute
source§fn from(t: FontFamily) -> TextAttribute
fn from(t: FontFamily) -> TextAttribute
source§impl Hash for FontFamily
impl Hash for FontFamily
source§impl PartialEq<FontFamily> for FontFamily
impl PartialEq<FontFamily> for FontFamily
source§fn eq(&self, other: &FontFamily) -> bool
fn eq(&self, other: &FontFamily) -> bool
self
and other
values to be equal, and is used
by ==
.