[−][src]Struct plotters::prelude::FontDesc
Describes a font
Methods
impl<'a> FontDesc<'a>
[src]
pub fn new(family: FontFamily<'a>, size: f64, style: FontStyle) -> Self
[src]
Create a new font
family
: The font family namesize
: The size of the fontstyle
: The font variations- returns The newly created font description
pub fn resize(&self, size: f64) -> FontDesc<'a>
[src]
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
pub fn style(&self, style: FontStyle) -> Self
[src]
Set the style of the font
style
: The new style- returns The new font description with this style applied
pub fn transform(&self, trans: FontTransform) -> Self
[src]
Set the font transformation
trans
: The new transformation- returns The new font description with this font transformation applied
pub fn get_transform(&self) -> FontTransform
[src]
Get the font transformation description
pub fn color<C: Color>(&self, color: &C) -> TextStyle<'a>
[src]
Set the color of the font and return the result text style object
pub fn get_name(&self) -> &str
[src]
Get the name of the font
pub fn get_style(&self) -> FontStyle
[src]
Get the name of the style
pub fn get_size(&self) -> f64
[src]
Get the size of font
pub fn layout_box(&self, text: &str) -> FontResult<((i32, i32), (i32, i32))>
[src]
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
pub fn box_size(&self, text: &str) -> FontResult<(u32, u32)>
[src]
Get the size of the text if rendered in this font.
This is similar to layout_box
function, but it apply the font transformation
and estimate the overall size of the font
pub fn draw<E, DrawFunc: FnMut(i32, i32, f32) -> Result<(), E>>(
&self,
text: &str,
(x, y): (i32, i32),
draw: DrawFunc
) -> FontResult<Result<(), E>>
[src]
&self,
text: &str,
(x, y): (i32, i32),
draw: DrawFunc
) -> FontResult<Result<(), E>>
Actually draws a font with a drawing function
Trait Implementations
impl<'a> IntoTextStyle<'a> for FontDesc<'a>
[src]
fn into_text_style<P: HasDimension>(self, _: &P) -> TextStyle<'a>
[src]
impl<'a> Clone for FontDesc<'a>
[src]
impl<'a> From<&'a str> for FontDesc<'a>
[src]
impl<'a> From<FontFamily<'a>> for FontDesc<'a>
[src]
fn from(family: FontFamily<'a>) -> FontDesc<'a>
[src]
impl<'a, T: Into<f64>> From<(FontFamily<'a>, T)> for FontDesc<'a>
[src]
impl<'a, T: Into<f64>> From<(&'a str, T)> for FontDesc<'a>
[src]
impl<'a, T: Into<f64>, S: Into<FontStyle>> From<(FontFamily<'a>, T, S)> for FontDesc<'a>
[src]
impl<'a, T: Into<f64>, S: Into<FontStyle>> From<(&'a str, T, S)> for FontDesc<'a>
[src]
Auto Trait Implementations
impl<'a> Send for FontDesc<'a>
impl<'a> Unpin for FontDesc<'a>
impl<'a> Sync for FontDesc<'a>
impl<'a> UnwindSafe for FontDesc<'a>
impl<'a> RefUnwindSafe for FontDesc<'a>
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
D: AdaptFrom<S, Swp, Dwp, T>,
Dwp: WhitePoint,
Swp: WhitePoint,
T: Component + Float,
[src]
D: AdaptFrom<S, Swp, Dwp, T>,
Dwp: WhitePoint,
Swp: WhitePoint,
T: Component + Float,
fn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
[src]
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into(self) -> D
[src]
impl<T, U> ConvertInto<U> for T where
U: ConvertFrom<T>,
[src]
U: ConvertFrom<T>,