Struct audio_processor_testing_helpers::charts::TextStyle
source · [−]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
sourceimpl<'a> TextStyle<'a>
impl<'a> TextStyle<'a>
sourcepub fn color<C>(&self, color: &'a C) -> TextStyle<'a> where
C: Color,
pub fn color<C>(&self, color: &'a C) -> TextStyle<'a> where
C: Color,
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) -> TextStyle<'a>
pub fn transform(&self, trans: FontTransform) -> TextStyle<'a>
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) -> TextStyle<'a>
pub fn pos(&self, pos: Pos) -> TextStyle<'a>
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
sourceimpl<'a> BackendTextStyle for TextStyle<'a>
impl<'a> BackendTextStyle for TextStyle<'a>
type FontError = <FontDataInternal as FontData>::ErrorType
type FontError = <FontDataInternal as FontData>::ErrorType
The error type of this text style implementation
fn color(&self) -> BackendColor
fn size(&self) -> f64
fn transform(&self) -> FontTransform
fn style(&self) -> FontStyle
fn layout_box(
&self,
text: &str
) -> Result<((i32, i32), (i32, i32)), <TextStyle<'a> as BackendTextStyle>::FontError>
fn anchor(&self) -> Pos
fn family(&self) -> FontFamily<'_>
fn draw<E, DrawFunc>(
&self,
text: &str,
pos: (i32, i32),
draw: DrawFunc
) -> Result<Result<(), E>, <TextStyle<'a> as BackendTextStyle>::FontError> where
DrawFunc: FnMut(i32, i32, BackendColor) -> Result<(), E>,
sourceimpl<'a, 'b> Into<TextStyle<'a>> for &'b TextStyle<'a> where
'b: 'a,
impl<'a, 'b> Into<TextStyle<'a>> for &'b TextStyle<'a> where
'b: 'a,
Make sure that we are able to automatically copy the TextStyle
sourceimpl<'a> IntoTextStyle<'a> for TextStyle<'a>
impl<'a> IntoTextStyle<'a> for TextStyle<'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 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
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