pub struct ShapedLine {
pub text: SharedString,
/* private fields */
}Expand description
A line of text that has been shaped and decorated.
Fields§
§text: SharedStringThe text that was shaped for this line.
Implementations§
Source§impl ShapedLine
impl ShapedLine
Sourcepub fn width(&self) -> Pixels
pub fn width(&self) -> Pixels
The width of the shaped line in pixels.
This is the glyph advance width computed by the text shaping system and is useful for incrementally advancing a “pen” when painting multiple fragments on the same row.
Sourcepub fn with_len(self, len: usize) -> Self
pub fn with_len(self, len: usize) -> Self
Override the len, useful if you’re rendering text a as text b (e.g. rendering invisibles).
Sourcepub fn paint(
&self,
origin: Point<Pixels>,
line_height: Pixels,
align: TextAlign,
align_width: Option<Pixels>,
window: &mut Window,
cx: &mut App,
) -> Result<()>
pub fn paint( &self, origin: Point<Pixels>, line_height: Pixels, align: TextAlign, align_width: Option<Pixels>, window: &mut Window, cx: &mut App, ) -> Result<()>
Paint the line of text to the window.
Sourcepub fn paint_background(
&self,
origin: Point<Pixels>,
line_height: Pixels,
align: TextAlign,
align_width: Option<Pixels>,
window: &mut Window,
cx: &mut App,
) -> Result<()>
pub fn paint_background( &self, origin: Point<Pixels>, line_height: Pixels, align: TextAlign, align_width: Option<Pixels>, window: &mut Window, cx: &mut App, ) -> Result<()>
Paint the background of the line to the window.
Sourcepub fn split_at(&self, byte_index: usize) -> (ShapedLine, ShapedLine)
pub fn split_at(&self, byte_index: usize) -> (ShapedLine, ShapedLine)
Split this shaped line at a byte index, returning (prefix, suffix).
prefixcontains glyphs for bytes[0, byte_index)with original positions. Its width equals the x-advance up to the split point.suffixcontains glyphs for bytes[byte_index, len)with positions shifted left so the first glyph starts at x=0, and byte indices rebased to 0.- Decoration runs are partitioned at the boundary; a run that straddles it is split into two with adjusted lengths.
font_size,ascent, anddescentare copied to both halves.
Trait Implementations§
Source§impl Clone for ShapedLine
impl Clone for ShapedLine
Source§fn clone(&self) -> ShapedLine
fn clone(&self) -> ShapedLine
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ShapedLine
impl Debug for ShapedLine
Source§impl Default for ShapedLine
impl Default for ShapedLine
Source§fn default() -> ShapedLine
fn default() -> ShapedLine
Returns the “default value” for a type. Read more
Source§impl Deref for ShapedLine
impl Deref for ShapedLine
Auto Trait Implementations§
impl Freeze for ShapedLine
impl RefUnwindSafe for ShapedLine
impl Send for ShapedLine
impl Sync for ShapedLine
impl Unpin for ShapedLine
impl UnsafeUnpin for ShapedLine
impl UnwindSafe for ShapedLine
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().