pub struct TextStyle<'a> {
    pub font: FontDesc<'a>,
    pub color: BackendColor,
    pub pos: Pos,
}
Expand description

Style of a text

Fields

font: FontDesc<'a>

The font description

color: BackendColor

The text color

pos: Pos

The anchor point position

Implementations

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);

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);

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);
See also

IntoTextStyle::with_anchor()

Trait Implementations

The error type of this text style implementation

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Make sure that we are able to automatically copy the TextStyle

Converts to this type from the input type.

Converts to this type from the input type.

Converts the value into a TextStyle value. Read more

Specifies the color of the text element Read more

Specifies the position of the text anchor relative to the text element Read more

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.

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.