Skip to main content

TextGeometry

Struct TextGeometry 

Source
pub struct TextGeometry { /* private fields */ }
Expand description

A text block’s final layout as the platform engine made it ([crate::Text::on_text_layout]), to ask where its characters are: the engine’s own answers, not an estimate from the lines.

Offsets are UTF-16 units in the block’s own text: the empty placeholders the core adds for a span’s padding are not counted, so they match the text the app gave. Boxes are in the content box (y down, points). Rust-only: it holds the engine and lives on the engine thread.

Implementations§

Source§

impl TextGeometry

Source

pub fn lines(&self) -> Vec<TextLine>

Its lines, in order, with their characters.

Source

pub fn hit_test(&self, point: Point<Points>) -> TextPosition

The caret position nearest point (content box).

Source

pub fn caret_rect(&self, position: TextPosition) -> Option<Bounds<Points>>

The caret at position: a box of no width as high as its line.

Source

pub fn range_rects(&self, range: Range<u32>) -> Vec<Bounds<Points>>

The boxes that cover the characters of range, line high.

Trait Implementations§

Source§

impl Clone for TextGeometry

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TextGeometry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for TextGeometry

§

impl !Send for TextGeometry

§

impl !Sync for TextGeometry

§

impl !UnwindSafe for TextGeometry

§

impl Forget for TextGeometry

§

impl Freeze for TextGeometry
where *const RcInner<dyn GeometryEngine> is !null: Freeze, PhantomData<RcInner<dyn GeometryEngine>>: Freeze, *const ArcInner<dyn Any + Send + Sync> is !null: Freeze, PhantomData<ArcInner<dyn Any + Send + Sync>>: Freeze, *const ArcInner<AttributedText> is !null: Freeze, PhantomData<ArcInner<AttributedText>>: Freeze, *const ArcInner<[u32]> is !null: Freeze, PhantomData<ArcInner<[u32]>>: Freeze,

§

impl Move for TextGeometry

§

impl Unpin for TextGeometry
where Rc<dyn GeometryEngine>: Unpin, Arc<dyn Any + Send + Sync>: Unpin, Arc<AttributedText>: Unpin, Arc<[u32]>: Unpin,

§

impl UnsafeUnpin for TextGeometry
where *const RcInner<dyn GeometryEngine> is !null: UnsafeUnpin, PhantomData<RcInner<dyn GeometryEngine>>: UnsafeUnpin, *const ArcInner<dyn Any + Send + Sync> is !null: UnsafeUnpin, PhantomData<ArcInner<dyn Any + Send + Sync>>: UnsafeUnpin, *const ArcInner<AttributedText> is !null: UnsafeUnpin, PhantomData<ArcInner<AttributedText>>: UnsafeUnpin, *const ArcInner<[u32]> is !null: UnsafeUnpin, PhantomData<ArcInner<[u32]>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.