[−][src]Struct tetra::graphics::text::Text
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]
S: Into<String>,
Creates a new Text
, with the given content, font and scale.
pub fn set_content<S>(&mut self, content: S) where
S: Into<String>,
[src]
S: Into<String>,
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 set_font(&mut self, font: Font)
[src]
Sets the font of the text.
pub fn set_size(&mut self, size: f32)
[src]
Sets the size of the text.
Trait Implementations
impl Drawable for Text
[src]
fn draw<P>(&self, ctx: &mut Context, params: P) where
P: Into<DrawParams>,
[src]
P: Into<DrawParams>,
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Same for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf 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> 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
.