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§

A san-serif font, such as Arial or Helvetica.

A serif font, such as Times New Roman or Charter.

The platform’s preferred UI font; San Francisco on macOS, and Segoe UI on recent Windows.

A monospace font.

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.

The name of the font family.

Returns true if this is a generic font family.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Converts to this type from the input type.
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Performs the conversion.
Performs the conversion.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.