pub struct TextStyle<'a> {
pub font: FontDesc<'a>,
pub color: RGBAColor,
pub pos: Pos,
}
Expand description
Style of a text
Fields§
§font: FontDesc<'a>
The font description
color: RGBAColor
The text color
pos: Pos
The anchor point position
Implementations§
Source§impl<'a> TextStyle<'a>
impl<'a> TextStyle<'a>
Sourcepub fn color<C: Color>(&self, color: &'a C) -> Self
pub fn color<C: Color>(&self, color: &'a C) -> Self
Sets the color of the style.
color
: The required color- returns The up-to-dated text style
use plotters::prelude::*;
let style = TextStyle::from(("sans-serif", 20).into_font()).color(&RED);
Sourcepub fn transform(&self, trans: FontTransform) -> Self
pub fn transform(&self, trans: FontTransform) -> Self
Sets the font transformation of the style.
trans
: The required transformation- returns The up-to-dated text style
use plotters::prelude::*;
let style = TextStyle::from(("sans-serif", 20).into_font()).transform(FontTransform::Rotate90);
Sourcepub fn pos(&self, pos: Pos) -> Self
pub fn pos(&self, pos: Pos) -> Self
Sets the anchor position.
pos
: The required anchor position- returns The up-to-dated text style
use plotters::prelude::*;
use plotters::style::text_anchor::{Pos, HPos, VPos};
let pos = Pos::new(HPos::Left, VPos::Top);
let style = TextStyle::from(("sans-serif", 20).into_font()).pos(pos);
Trait Implementations§
Source§impl<'a, 'b: 'a> Into<TextStyle<'a>> for &'b TextStyle<'a>
Make sure that we are able to automatically copy the TextStyle
impl<'a, 'b: 'a> Into<TextStyle<'a>> for &'b TextStyle<'a>
Make sure that we are able to automatically copy the TextStyle
Source§impl<'a> IntoTextStyle<'a> for TextStyle<'a>
impl<'a> IntoTextStyle<'a> for TextStyle<'a>
fn into_text_style<P: HasDimension>(self, _: &P) -> TextStyle<'a>
Auto Trait Implementations§
impl<'a> Freeze for TextStyle<'a>
impl<'a> RefUnwindSafe for TextStyle<'a>
impl<'a> Send for TextStyle<'a>
impl<'a> Sync for TextStyle<'a>
impl<'a> Unpin for TextStyle<'a>
impl<'a> UnwindSafe for TextStyle<'a>
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
Convert the source color to the destination color using the specified
method
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Convert the source color to the destination color using the bradford
method by default
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
Source§fn convert_into(self) -> U
fn convert_into(self) -> U
Convert into T with values clamped to the color defined bounds Read more
Source§fn convert_unclamped_into(self) -> U
fn convert_unclamped_into(self) -> U
Convert into T. The resulting color might be invalid in its color space Read more
Source§fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
Convert into T, returning ok if the color is inside of its defined range,
otherwise an
OutOfBounds
error is returned which contains the unclamped color. Read more