[−][src]Struct ggez::graphics::Text
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]
F: Into<TextFragment>,
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]
F: Into<TextFragment>,
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]
P: Into<Point2<f32>>,
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]
fn draw(&self, ctx: &mut Context, param: DrawParam) -> GameResult
[src]
fn dimensions(&self, ctx: &mut Context) -> Option<Rect>
[src]
fn set_blend_mode(&mut self, mode: Option<BlendMode>)
[src]
fn blend_mode(&self) -> Option<BlendMode>
[src]
impl Clone for Text
[src]
fn clone(&self) -> 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]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn is_in_subset(&self) -> bool
unsafe fn to_subset_unchecked(&self) -> SS
fn from_subset(element: &SS) -> 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>,
T: Parameter<Self>,
Sets value
as a parameter of self
.