pub struct FontDesc<'a> { /* private fields */ }
Expand description
Describes a font
Implementations§
Source§impl<'a> FontDesc<'a>
impl<'a> FontDesc<'a>
Sourcepub fn new(family: FontFamily<'a>, size: f64, style: FontStyle) -> Self
pub fn new(family: FontFamily<'a>, size: f64, style: FontStyle) -> Self
Create a new font
family
: The font family namesize
: The size of the fontstyle
: The font variations- returns The newly created font description
Sourcepub fn resize(&self, size: f64) -> Self
pub fn resize(&self, size: f64) -> Self
Create a new font desc with the same font but different size
size
: The new size to set- returns The newly created font descriptor with a new size
Sourcepub fn style(&self, style: FontStyle) -> Self
pub fn style(&self, style: FontStyle) -> Self
Set the style of the font
style
: The new style- returns The new font description with this style applied
Sourcepub fn transform(&self, trans: FontTransform) -> Self
pub fn transform(&self, trans: FontTransform) -> Self
Set the font transformation
trans
: The new transformation- returns The new font description with this font transformation applied
Sourcepub fn get_transform(&self) -> FontTransform
pub fn get_transform(&self) -> FontTransform
Get the font transformation description
Sourcepub fn color<C: Color>(&self, color: &C) -> TextStyle<'a>
pub fn color<C: Color>(&self, color: &C) -> TextStyle<'a>
Set the color of the font and return the result text style object
pub fn get_family(&self) -> FontFamily<'_>
Sourcepub fn layout_box(&self, text: &str) -> FontResult<((i32, i32), (i32, i32))>
pub fn layout_box(&self, text: &str) -> FontResult<((i32, i32), (i32, i32))>
Get the size of the text if rendered in this font
For a TTF type, zero point of the layout box is the left most baseline char of the string Thus the upper bound of the box is most likely be negative
Trait Implementations§
Source§impl<'a, T: Into<f64>> From<(FontFamily<'a>, T)> for FontDesc<'a>
impl<'a, T: Into<f64>> From<(FontFamily<'a>, T)> for FontDesc<'a>
Source§fn from((family, size): (FontFamily<'a>, T)) -> FontDesc<'a>
fn from((family, size): (FontFamily<'a>, T)) -> FontDesc<'a>
Converts to this type from the input type.
Source§impl<'a, T: Into<f64>, S: Into<FontStyle>> From<(FontFamily<'a>, T, S)> for FontDesc<'a>
impl<'a, T: Into<f64>, S: Into<FontStyle>> From<(FontFamily<'a>, T, S)> for FontDesc<'a>
Source§fn from((family, size, style): (FontFamily<'a>, T, S)) -> FontDesc<'a>
fn from((family, size, style): (FontFamily<'a>, T, S)) -> FontDesc<'a>
Converts to this type from the input type.
Source§impl<'a> From<FontFamily<'a>> for FontDesc<'a>
impl<'a> From<FontFamily<'a>> for FontDesc<'a>
Source§fn from(family: FontFamily<'a>) -> FontDesc<'a>
fn from(family: FontFamily<'a>) -> FontDesc<'a>
Converts to this type from the input type.
Source§impl<'a> IntoTextStyle<'a> for FontDesc<'a>
impl<'a> IntoTextStyle<'a> for FontDesc<'a>
Auto Trait Implementations§
impl<'a> Freeze for FontDesc<'a>
impl<'a> RefUnwindSafe for FontDesc<'a>
impl<'a> Send for FontDesc<'a>
impl<'a> Sync for FontDesc<'a>
impl<'a> Unpin for FontDesc<'a>
impl<'a> UnwindSafe for FontDesc<'a>
Blanket Implementations§
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
Mutably borrows from an owned value. Read more