pub struct Text<'a> { /* private fields */ }Expand description
Text builder struct. Call
finish to draw the text.
Created by Font::draw.
Implementations§
Source§impl<'a> Text<'a>
impl<'a> Text<'a>
Sourcepub fn finish(&mut self) -> Option<Rect>
pub fn finish(&mut self) -> Option<Rect>
Draws the text, and returns the bounding box of all the glyphs drawn, if any were.
Sourcepub fn color(
&mut self,
(red, green, blue, alpha): (f32, f32, f32, f32),
) -> &mut Self
pub fn color( &mut self, (red, green, blue, alpha): (f32, f32, f32, f32), ) -> &mut Self
Sets the text’s color.
Sourcepub fn alignment(&mut self, alignment: Alignment) -> &mut Self
pub fn alignment(&mut self, alignment: Alignment) -> &mut Self
Sets the text’s alignment. Does nothing if max width isn’t specified: the x-coordinate of this text is considered to be the left border, and the max width of the text + the x-coordinate the right.
Sourcepub fn clip_area<R: Into<Rect>>(&mut self, clip_area: R) -> &mut Self
pub fn clip_area<R: Into<Rect>>(&mut self, clip_area: R) -> &mut Self
Sets the clipping area, ie. the area where the text will be rendered. Text that is not inside the clip area will be clipped off.
Sourcepub fn visibility(&mut self, visible: bool) -> &mut Self
pub fn visibility(&mut self, visible: bool) -> &mut Self
Sets the visibility of the text. If false, the text will not be rendered. That is, only the bounding box of the text will be calculated.
Useful for measuring the bounding box of some piece of text, without spending performance drawing it with 0 alpha, which would make it invisible as well.