[][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().

Methods

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: Scale) -> &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: &mut Context) -> (u32, u32)[src]

Returns the width and height of the formatted and wrapped text.

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

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

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

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

Trait Implementations

impl Drawable for Text[src]

impl Clone for Text[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Default for Text[src]

impl Debug for Text[src]

Auto Trait Implementations

impl Unpin for Text

impl !Sync for Text

impl Send for Text

impl !RefUnwindSafe for Text

impl UnwindSafe for Text

Blanket Implementations

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

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

type Owned = T

The resulting type after obtaining ownership.

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

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<T> Erased for T

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.