pub struct Text { /* private fields */ }
Expand description
A piece of text that can be rendered.
Implementations§
source§impl Text
impl Text
sourcepub fn new<S>(content: S, font: Font, size: f32) -> Textwhere
S: Into<String>,
pub fn new<S>(content: S, font: Font, size: f32) -> Textwhere
S: Into<String>,
Creates a new Text
, with the given content, font and scale.
sourcepub fn set_content<S>(&mut self, content: S)where
S: Into<String>,
pub fn set_content<S>(&mut self, content: S)where
S: Into<String>,
Sets the content of the text.
sourcepub fn get_bounds(&self, ctx: &mut Context) -> Option<Rectangle>
pub fn get_bounds(&self, ctx: &mut Context) -> Option<Rectangle>
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
.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Text
impl Send for Text
impl !Sync for Text
impl Unpin for Text
impl UnwindSafe for Text
Blanket Implementations§
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> SetParameter for T
impl<T> SetParameter for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.