Struct cosmic_text::ShapeLine
source · pub struct ShapeLine {
pub rtl: bool,
pub spans: Vec<ShapeSpan>,
pub metrics_opt: Option<Metrics>,
}
Expand description
A shaped line (or paragraph)
Fields§
§rtl: bool
§spans: Vec<ShapeSpan>
§metrics_opt: Option<Metrics>
Implementations§
source§impl ShapeLine
impl ShapeLine
sourcepub fn new(
font_system: &mut FontSystem,
line: &str,
attrs_list: &AttrsList,
shaping: Shaping,
tab_width: u16,
) -> Self
pub fn new( font_system: &mut FontSystem, line: &str, attrs_list: &AttrsList, shaping: Shaping, tab_width: u16, ) -> Self
Shape a line into a set of spans, using a scratch buffer. If unicode_bidi::BidiInfo
detects multiple paragraphs, they will be joined.
§Panics
Will panic if line
contains multiple paragraphs that do not have matching direction
sourcepub fn build(
&mut self,
font_system: &mut FontSystem,
line: &str,
attrs_list: &AttrsList,
shaping: Shaping,
tab_width: u16,
)
pub fn build( &mut self, font_system: &mut FontSystem, line: &str, attrs_list: &AttrsList, shaping: Shaping, tab_width: u16, )
pub fn layout( &self, font_size: f32, width_opt: Option<f32>, wrap: Wrap, align: Option<Align>, match_mono_width: Option<f32>, ) -> Vec<LayoutLine>
pub fn layout_to_buffer( &self, scratch: &mut ShapeBuffer, font_size: f32, width_opt: Option<f32>, wrap: Wrap, align: Option<Align>, layout_lines: &mut Vec<LayoutLine>, match_mono_width: Option<f32>, )
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ShapeLine
impl RefUnwindSafe for ShapeLine
impl Send for ShapeLine
impl Sync for ShapeLine
impl Unpin for ShapeLine
impl UnwindSafe for ShapeLine
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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 more