pub struct Text<'a> { /* private fields */ }
Expand description
An instance of some multi-line text and its layout.
Implementations§
source§impl<'a> Text<'a>
impl<'a> Text<'a>
sourcepub fn line_infos(&self) -> &[Info]
pub fn line_infos(&self) -> &[Info]
Produce an iterator yielding information about each line.
sourcepub fn layout_rect(&self) -> Rect
pub fn layout_rect(&self) -> Rect
The rectangle used to layout and build the text instance.
This is the same Rect
that was passed to the text::Builder::build
method.
sourcepub fn bounding_rect(&self) -> Rect
pub fn bounding_rect(&self) -> Rect
The rectangle that describes the min and max bounds along each axis reached by the text.
sourcepub fn bounding_rect_by_lines(&self) -> Rect
pub fn bounding_rect_by_lines(&self) -> Rect
The rectangle that describes the min and max bounds along each axis reached by the text.
This is similar to bounding_rect
but assumes that all lines have a height equal to
font_size
, rather than using the exact height.
sourcepub fn height(&self) -> Scalar
pub fn height(&self) -> Scalar
The exact height of the full text accounting for font size and line spacing..
sourcepub fn height_by_lines(&self) -> Scalar
pub fn height_by_lines(&self) -> Scalar
Determine the total height of a block of text with the given number of lines, font size and
line_spacing
(the space that separates each line of text).
The height of all lines of text are assumed to match the font_size
. If looking for the exact
height, see the exact_height
function.
sourcepub fn lines(&self) -> TextLines<'_>
pub fn lines(&self) -> TextLines<'_>
Produce an iterator yielding each wrapped line within the Text.
sourcepub fn line_rects(&self) -> TextLineRects<'_> ⓘ
pub fn line_rects(&self) -> TextLineRects<'_> ⓘ
The bounding rectangle for each line.
sourcepub fn lines_with_rects(&self) -> TextLinesWithRects<'_>
pub fn lines_with_rects(&self) -> TextLinesWithRects<'_>
Produce an iterator yielding all lines of text alongside their bounding rects.
sourcepub fn glyphs_per_line(&self) -> TextGlyphsPerLine<'_>
pub fn glyphs_per_line(&self) -> TextGlyphsPerLine<'_>
Produce an iterator yielding iterators yielding every glyph alongside its bounding rect for each line.
sourcepub fn glyphs(&self) -> TextGlyphs<'_>
pub fn glyphs(&self) -> TextGlyphs<'_>
Produce an iterator yielding every glyph alongside its bounding rect.
This is the “flattened” version of the glyphs_per_line
method.
sourcepub fn path_events<'b>(&'b self) -> impl 'b + Iterator<Item = PathEvent>
pub fn path_events<'b>(&'b self) -> impl 'b + Iterator<Item = PathEvent>
Produce an iterator yielding the path events for every glyph in every line.
sourcepub fn rt_glyphs<'b: 'a>(
&'b self,
window_size: Vec2,
scale_factor: Scalar
) -> impl 'a + 'b + Iterator<Item = PositionedGlyph>
pub fn rt_glyphs<'b: 'a>( &'b self, window_size: Vec2, scale_factor: Scalar ) -> impl 'a + 'b + Iterator<Item = PositionedGlyph>
Produce an iterator yielding positioned rusttype glyphs ready for caching.
The window dimensions (in logical space) and scale_factor are required to transform glyph positions into rusttype’s pixel-space, ready for caching into the rusttype glyph cache pixel buffer.
sourcepub fn into_owned(self) -> Text<'static>
pub fn into_owned(self) -> Text<'static>
Converts this Text
instance into an instance that owns the inner text string.
Trait Implementations§
Auto Trait Implementations§
impl<'a> RefUnwindSafe for Text<'a>
impl<'a> Send for Text<'a>
impl<'a> Sync for Text<'a>
impl<'a> Unpin for Text<'a>
impl<'a> UnwindSafe for Text<'a>
Blanket Implementations§
source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
source§fn convert_into(self) -> U
fn convert_into(self) -> U
source§fn convert_unclamped_into(self) -> U
fn convert_unclamped_into(self) -> U
source§fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains the unclamped color. Read more