pub struct LeafGeometry { /* private fields */ }Expand description
Where one keyed text leaf was laid out in the last frame.
Indices are byte offsets into the leaf’s text, where each inline atom
(image, custom node) is one U+FFFC (3 bytes). Coordinates are window
pixels and are valid for the frame that produced them. It is a value, not a
handle: it owns its bounds and shares immutable shaped lines, never the
renderer’s mutable layout state. Later frames do not mutate this snapshot.
The host must replace it after content, width, typography or scrolling changes.
Implementations§
Source§impl LeafGeometry
impl LeafGeometry
Sourcepub fn line_height(&self) -> Pixels
pub fn line_height(&self) -> Pixels
The height of a line.
Sourcepub fn caret_height(&self) -> Pixels
pub fn caret_height(&self) -> Pixels
The height of a caret: the font’s ascent plus descent, not the whole line box, which includes leading.
Sourcepub fn position_for_index(&self, index: usize) -> Point<Pixels>
pub fn position_for_index(&self, index: usize) -> Point<Pixels>
The top of a caret placed at byte index, in window coordinates.
Sourcepub fn index_for_position(&self, at: Point<Pixels>) -> usize
pub fn index_for_position(&self, at: Point<Pixels>) -> usize
The byte index of the caret position closest to at: glyph halves
round to the nearer side, unlike TextLayout::index_for_position.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LeafGeometry
impl RefUnwindSafe for LeafGeometry
impl Send for LeafGeometry
impl Sync for LeafGeometry
impl Unpin for LeafGeometry
impl UnsafeUnpin for LeafGeometry
impl UnwindSafe for LeafGeometry
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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