pub struct PreparedTextLayout {
pub text: Rc<AnnotatedString>,
pub visual_style: Arc<TextStyle>,
pub layout: TextLayout,
pub render_text: OnceCell<(Arc<RenderString>, PackedU64)>,
/* private fields */
}Expand description
A text laid out between two widths: its glyphs and lines, which every query, measurement and renderer reads, and the size it measures.
Fields§
§text: Rc<AnnotatedString>The text that was laid out.
visual_style: Arc<TextStyle>The style the text draws in, shared with every render node drawn from this layout.
layout: TextLayoutThe lines and glyphs.
render_text: OnceCell<(Arc<RenderString>, PackedU64)>text as a renderer draws it, and its
RenderString::render_hash,
converted on first use: see PreparedTextLayout::render_text.
Implementations§
Source§impl PreparedTextLayout
impl PreparedTextLayout
Sourcepub fn size(&self) -> Size
pub fn size(&self) -> Size
The paragraph’s width, within the widths it was laid out between, and the height of all its lines together.
Sourcepub fn metrics(&self) -> TextMetrics
pub fn metrics(&self) -> TextMetrics
Size and line count.
Sourcepub fn alignment_lines(&self) -> AlignmentLines
pub fn alignment_lines(&self) -> AlignmentLines
The first and last baselines.
Sourcepub fn did_overflow(&self) -> bool
pub fn did_overflow(&self) -> bool
True when the text did not fit: it had more lines than the line limit, or was wider than the widest it could be.
Sourcepub fn render_text(&self) -> Arc<RenderString> ⓘ
pub fn render_text(&self) -> Arc<RenderString> ⓘ
The display text as a renderer draws it. Converted once for the layout and shared after, so every frame and scene rebuild drawing this layout hands over the same allocation.
Sourcepub fn render_text_hash(&self) -> u64
pub fn render_text_hash(&self) -> u64
RenderString::render_hash
of PreparedTextLayout::render_text, kept beside it so that reading
it never loads the string.
Sourcepub fn visual_style_hash(&self) -> u64
pub fn visual_style_hash(&self) -> u64
TextStyle::render_hash of visual_style, hashed once for the
layout, or handed over by the node that knows its style’s hash.
Sourcepub fn result(&self) -> TextLayoutResult
pub fn result(&self) -> TextLayoutResult
The layout’s queries, as Compose’s TextLayoutResult gives them.
Trait Implementations§
Source§impl Clone for PreparedTextLayout
impl Clone for PreparedTextLayout
Source§impl Debug for PreparedTextLayout
impl Debug for PreparedTextLayout
Auto Trait Implementations§
impl !Freeze for PreparedTextLayout
impl !RefUnwindSafe for PreparedTextLayout
impl !Send for PreparedTextLayout
impl !Sync for PreparedTextLayout
impl !UnwindSafe for PreparedTextLayout
impl Forget for PreparedTextLayout
impl Move for PreparedTextLayout
impl Unpin for PreparedTextLayout
impl UnsafeUnpin for PreparedTextLayout
Blanket Implementations§
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more