[][src]Struct ggez::graphics::Text

pub struct Text { /* fields omitted */ }

Drawable text object. Essentially a list of TextFragment's and some cached size information.

It implements Drawable so it can be drawn immediately with graphics::draw(), or many of them can be queued with graphics::queue_text() and then all drawn at once with graphics::draw_queued_text().

Implementations

impl Text[src]

pub fn new<F>(fragment: F) -> Text where
    F: Into<TextFragment>, 
[src]

Creates a Text from a TextFragment.

let text = Text::new("foo");

pub fn add<F>(&mut self, fragment: F) -> &mut Text where
    F: Into<TextFragment>, 
[src]

Appends a TextFragment to the Text.

pub fn fragments(&self) -> &[TextFragment][src]

Returns a read-only slice of all TextFragment's.

pub fn fragments_mut(&mut self) -> &mut [TextFragment][src]

Returns a mutable slice with all fragments.

pub fn set_bounds<P>(&mut self, bounds: P, alignment: Align) -> &mut Text where
    P: Into<Point2<f32>>, 
[src]

Specifies rectangular dimensions to try and fit contents inside of, by wrapping, and alignment within the bounds. To disable wrapping, give it a layout with f32::INF for the x value.

pub fn set_font(&mut self, font: Font, font_scale: PxScale) -> &mut Text[src]

Specifies text's font and font scale; used for fragments that don't have their own.

pub fn contents(&self) -> String[src]

Returns the string that the text represents.

pub fn dimensions(&self, context: &Context) -> Rect[src]

Returns a Rect containing the width and height of the formatted and wrapped text.

pub fn width(&self, context: &Context) -> f32[src]

Returns the width of formatted and wrapped text, in screen coordinates.

pub fn height(&self, context: &Context) -> f32[src]

Returns the height of formatted and wrapped text, in screen coordinates.

Trait Implementations

impl Clone for Text[src]

impl Debug for Text[src]

impl Default for Text[src]

impl Drawable for Text[src]

Auto Trait Implementations

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> Pointable for T

type Init = T

The type for initializers.

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>,