[][src]Struct ggez::graphics::TextFragment

pub struct TextFragment {
    pub text: String,
    pub color: Option<Color>,
    pub font: Option<Font>,
    pub scale: Option<Scale>,
}

A piece of text with optional color, font and font scale information. Drawing text generally involves one or more of these. These options take precedence over any similar field/argument. Can be implicitly constructed from String, (String, Color), and (String, FontId, Scale).

Fields

text: String

Text string itself.

color: Option<Color>

Fragment's color, defaults to text's color.

font: Option<Font>

Fragment's font, defaults to text's font.

scale: Option<Scale>

Fragment's scale, defaults to text's scale.

Methods

impl TextFragment[src]

pub fn new<T: Into<Self>>(text: T) -> Self[src]

Creates a new fragment from String or &str.

pub fn color(self, color: Color) -> TextFragment[src]

Set fragment's color, overrides text's color.

pub fn font(self, font: Font) -> TextFragment[src]

Set fragment's font, overrides text's font.

pub fn scale(self, scale: Scale) -> TextFragment[src]

Set fragment's scale, overrides text's scale.

Trait Implementations

impl Default for TextFragment[src]

impl Clone for TextFragment[src]

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

Performs copy-assignment from source. Read more

impl<'a> From<&'a str> for TextFragment[src]

impl From<char> for TextFragment[src]

impl From<String> for TextFragment[src]

impl<T> From<(T, Font, f32)> for TextFragment where
    T: Into<TextFragment>, 
[src]

impl Debug for TextFragment[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From for T[src]

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

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

type Owned = T

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Same for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf 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.