pub struct WindowTextSystem { /* private fields */ }Expand description
The GPUI text layout subsystem.
Implementations§
Source§impl WindowTextSystem
impl WindowTextSystem
Sourcepub fn shape_line(
&self,
text: SharedString,
font_size: Pixels,
runs: &[TextRun],
force_width: Option<Pixels>,
) -> ShapedLine
pub fn shape_line( &self, text: SharedString, font_size: Pixels, runs: &[TextRun], force_width: Option<Pixels>, ) -> ShapedLine
Shape the given line, at the given font_size, for painting to the screen.
Subsets of the line can be styled independently with the runs parameter.
Note that this method can only shape a single line of text. It will panic
if the text contains newlines. If you need to shape multiple lines of text,
use Self::shape_text instead.
Sourcepub fn shape_text(
&self,
text: SharedString,
font_size: Pixels,
runs: &[TextRun],
wrap_width: Option<Pixels>,
line_clamp: Option<usize>,
) -> Result<SmallVec<[WrappedLine; 1]>>
pub fn shape_text( &self, text: SharedString, font_size: Pixels, runs: &[TextRun], wrap_width: Option<Pixels>, line_clamp: Option<usize>, ) -> Result<SmallVec<[WrappedLine; 1]>>
Shape a multi line string of text, at the given font_size, for painting to the screen.
Subsets of the text can be styled independently with the runs parameter.
If wrap_width is provided, the line breaks will be adjusted to fit within the given width.
Sourcepub fn layout_line(
&self,
text: &str,
font_size: Pixels,
runs: &[TextRun],
force_width: Option<Pixels>,
) -> Arc<LineLayout>
pub fn layout_line( &self, text: &str, font_size: Pixels, runs: &[TextRun], force_width: Option<Pixels>, ) -> Arc<LineLayout>
Layout the given line of text, at the given font_size.
Subsets of the line can be styled independently with the runs parameter.
Generally, you should prefer to use Self::shape_line instead, which
can be painted directly.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for WindowTextSystem
impl !RefUnwindSafe for WindowTextSystem
impl Send for WindowTextSystem
impl Sync for WindowTextSystem
impl Unpin for WindowTextSystem
impl !UnwindSafe for WindowTextSystem
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
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>. Box<dyn Any> can
then be further downcast into Box<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>. Rc<Any> 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> DowncastSync for T
impl<T> DowncastSync for T
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