[][src]Struct tetra::graphics::Text

pub struct Text { /* fields omitted */ }

A piece of text that can be rendered.

Methods

impl Text[src]

pub fn new<S>(content: S, font: Font, size: f32) -> Text where
    S: Into<String>, 
[src]

Creates a new Text, with the given content, font and scale.

pub fn content(&self) -> &str[src]

Gets the content of the text.

pub fn set_content<S>(&mut self, content: S) where
    S: Into<String>, 
[src]

Sets the content of the text.

pub fn get_bounds(&self, ctx: &mut Context) -> Option<Rectangle>[src]

Get the outer bounds of the text when rendered to the screen.

If the text is not rendered yet, this method will re-render it and calculate the bounds. The bounds are automatically cached, so calling this multiple times will only render once.

Note that this method will not take into account the positioning applied to the text via DrawParams.

pub fn font(&self) -> &Font[src]

Gets the font of the text.

pub fn set_font(&mut self, font: Font)[src]

Sets the font of the text.

pub fn size(&self) -> f32[src]

Gets the size of the text.

pub fn set_size(&mut self, size: f32)[src]

Sets the size of the text.

Trait Implementations

impl Clone for Text[src]

impl Debug for Text[src]

impl Drawable for Text[src]

Auto Trait Implementations

impl !RefUnwindSafe for Text

impl Send for Text

impl !Sync for Text

impl Unpin for Text

impl UnwindSafe for Text

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SetParameter for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,