pub struct Text {
lines: Vec<(Option<Color>, Vec<TextSpan>)>,
bg_color: Option<Color>,
}
Fields§
§lines: Vec<(Option<Color>, Vec<TextSpan>)>
§bg_color: Option<Color>
Implementations§
source§impl Text
impl Text
pub fn new() -> Text
pub fn from_all(lines: Vec<TextSpan>) -> Text
pub fn from_multiline(lines: Vec<impl Into<TextSpan>>) -> Text
pub fn bg(self, bg: Color) -> Text
pub fn tooltip<MK: Into<Option<MultiKey>>>( ctx: &EventCtx<'_>, hotkey: MK, action: &str ) -> Text
pub fn change_fg(self, fg: Color) -> Text
pub fn default_fg(self, fg: Color) -> Text
pub fn add_line(&mut self, line: impl Into<TextSpan>)
pub(crate) fn highlight_last_line(&mut self, highlight: Color)
pub fn append(&mut self, line: TextSpan)
pub fn add_appended(&mut self, lines: Vec<TextSpan>)
pub fn append_all(&mut self, lines: Vec<TextSpan>)
pub fn remove_colors_from_last_line(&mut self)
pub fn is_empty(&self) -> bool
pub fn extend(&mut self, other: Text)
pub(crate) fn dims(self, assets: &Assets) -> ScreenDims
pub fn rendered_width<A: AsRef<Assets>>(self, assets: &A) -> f64
sourcepub fn render<A: AsRef<Assets>>(self, assets: &A) -> GeomBatch
pub fn render<A: AsRef<Assets>>(self, assets: &A) -> GeomBatch
Render the text, without any autocropping. You can pass in an EventCtx
or GfxCtx
.
pub(crate) fn inner_render(self, assets: &Assets, tolerance: f32) -> GeomBatch
sourcepub fn render_autocropped<A: AsRef<Assets>>(self, assets: &A) -> GeomBatch
pub fn render_autocropped<A: AsRef<Assets>>(self, assets: &A) -> GeomBatch
Render the text, autocropping blank space out of the result. You can pass in an EventCtx
or GfxCtx
.
fn hash_key(&self) -> String
pub fn into_widget(self, ctx: &EventCtx<'_>) -> Widget
pub fn batch(self, ctx: &EventCtx<'_>) -> Widget
pub fn wrap_to_pct(self, ctx: &EventCtx<'_>, pct: usize) -> Text
pub fn wrap_to_pixels(self, ctx: &EventCtx<'_>, limit: f64) -> Text
pub(crate) fn inner_wrap_to_pixels(self, limit: f64, assets: &Assets) -> Text
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Text
impl RefUnwindSafe for Text
impl Send for Text
impl Sync for Text
impl Unpin for Text
impl UnwindSafe for Text
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
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
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.