Struct audio_processor_testing_helpers::charts::FontDesc
source · [−]pub struct FontDesc<'a> { /* private fields */ }
Expand description
Describes a font
Implementations
sourceimpl<'a> FontDesc<'a>
impl<'a> FontDesc<'a>
sourcepub fn new(family: FontFamily<'a>, size: f64, style: FontStyle) -> FontDesc<'a>
pub fn new(family: FontFamily<'a>, size: f64, style: FontStyle) -> FontDesc<'a>
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) -> FontDesc<'a>
pub fn resize(&self, size: f64) -> FontDesc<'a>
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) -> FontDesc<'a>
pub fn style(&self, style: FontStyle) -> FontDesc<'a>
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) -> FontDesc<'a>
pub fn transform(&self, trans: FontTransform) -> FontDesc<'a>
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>(&self, color: &C) -> TextStyle<'a> where
C: Color,
pub fn color<C>(&self, color: &C) -> TextStyle<'a> where
C: Color,
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
) -> Result<((i32, i32), (i32, i32)), <FontDataInternal as FontData>::ErrorType>
pub fn layout_box(
&self,
text: &str
) -> Result<((i32, i32), (i32, i32)), <FontDataInternal as FontData>::ErrorType>
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
sourceimpl<'a, T, S> From<(FontFamily<'a>, T, S)> for FontDesc<'a> where
T: Into<f64>,
S: Into<FontStyle>,
impl<'a, T, S> From<(FontFamily<'a>, T, S)> for FontDesc<'a> where
T: Into<f64>,
S: Into<FontStyle>,
sourceimpl<'a> From<FontFamily<'a>> for FontDesc<'a>
impl<'a> From<FontFamily<'a>> for FontDesc<'a>
sourcefn from(family: FontFamily<'a>) -> FontDesc<'a>
fn from(family: FontFamily<'a>) -> FontDesc<'a>
Converts to this type from the input type.
sourceimpl<'a> IntoTextStyle<'a> for FontDesc<'a>
impl<'a> IntoTextStyle<'a> for FontDesc<'a>
fn into_text_style<P>(self, &P) -> TextStyle<'a> where
P: HasDimension,
fn with_color<C>(self, color: C) -> TextStyleBuilder<'a, Self> where
C: Color,
fn with_anchor<C>(self, pos: Pos) -> TextStyleBuilder<'a, Self> where
C: Color,
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more