pub struct LineFragment {
pub text: String,
pub style: InlineStyle,
pub font: Arc<Font>,
pub font_size: f64,
pub x: f64,
pub width: f64,
pub ascent: f64,
pub descent: f64,
pub start_byte: usize,
}Expand description
One piece of a run as it sits on a single visual line: the smallest unit the painter draws. A wrapped run may contribute several fragments (one per line); adjacent same-style pieces on a line are merged into one fragment.
Fields§
§text: StringThe fragment’s characters.
style: InlineStyleThe inline style shared by every character in the fragment.
font: Arc<Font>Font this fragment was shaped/measured with (from the resolver).
font_size: f64Font size (points) used for this fragment.
x: f64X offset of this fragment’s left edge from the start of the line’s text.
width: f64Advance width of the fragment.
ascent: f64Ascent (px above baseline) at this fragment’s size.
descent: f64Descent (px below baseline) at this fragment’s size.
start_byte: usizeByte offset into the owning block’s flattened text where this
fragment’s text begins. Within a line, kept fragments are
byte-contiguous (dropped soft-wrap spaces only occur between lines),
so this plus text.len() yields the fragment’s exclusive byte end. The
interactive editor uses it to map caret DocPos byte
offsets to/from pixel geometry.
Trait Implementations§
Source§impl Clone for LineFragment
impl Clone for LineFragment
Source§fn clone(&self) -> LineFragment
fn clone(&self) -> LineFragment
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for LineFragment
impl RefUnwindSafe for LineFragment
impl Send for LineFragment
impl Sync for LineFragment
impl Unpin for LineFragment
impl UnsafeUnpin for LineFragment
impl UnwindSafe for LineFragment
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
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