Struct zng_wgt_ansi_text::AnsiText
source · pub struct AnsiText(/* private fields */);
Expand description
W
Render text styled using ANSI escape sequences.
Supports color, weight, italic and more, see AnsiStyle
for the full style supported.
Implementations§
source§impl AnsiText
impl AnsiText
sourcepub fn blink_interval(&self, interval: impl IntoVar<Duration>)
pub fn blink_interval(&self, interval: impl IntoVar<Duration>)
P
ANSI blink animation interval.
Set to ZERO
to disable the blink animation.
Sets the BLINK_INTERVAL_VAR
.
source§impl AnsiText
impl AnsiText
sourcepub fn text_fn(&self, wgt_fn: impl IntoVar<WidgetFn<TextFnArgs>>)
pub fn text_fn(&self, wgt_fn: impl IntoVar<WidgetFn<TextFnArgs>>)
P
Widget function that converts TextFnArgs
to widgets.
Sets the TEXT_FN_VAR
.
source§impl AnsiText
impl AnsiText
sourcepub fn line_fn(&self, wgt_fn: impl IntoVar<WidgetFn<LineFnArgs>>)
pub fn line_fn(&self, wgt_fn: impl IntoVar<WidgetFn<LineFnArgs>>)
P
Widget function that converts LineFnArgs
to widgets.
Sets the LINE_FN_VAR
.
source§impl AnsiText
impl AnsiText
sourcepub fn page_fn(&self, wgt_fn: impl IntoVar<WidgetFn<PageFnArgs>>)
pub fn page_fn(&self, wgt_fn: impl IntoVar<WidgetFn<PageFnArgs>>)
P
Widget function that converts PageFnArgs
to widgets.
A page is a stack of a maximum of lines_per_page
, the text is split in pages mostly for performance reasons.
Sets the PAGE_FN_VAR
.
source§impl AnsiText
impl AnsiText
sourcepub fn panel_fn(&self, wgt_fn: impl IntoVar<WidgetFn<PanelFnArgs>>)
pub fn panel_fn(&self, wgt_fn: impl IntoVar<WidgetFn<PanelFnArgs>>)
P
Widget function that converts PanelFnArgs
to widgets.
source§impl AnsiText
impl AnsiText
sourcepub fn lines_per_page(&self, count: impl IntoVar<u32>)
pub fn lines_per_page(&self, count: impl IntoVar<u32>)
P
Maximum number of lines per page view.
Sets the LINES_PER_PAGE_VAR
.
source§impl AnsiText
impl AnsiText
sourcepub fn widget_new() -> Self
pub fn widget_new() -> Self
Start building a new instance.
sourcepub fn widget_type() -> WidgetType
pub fn widget_type() -> WidgetType
Gets the widget type info.
Methods from Deref<Target = FontMix<TextSpacingMix<ParagraphMix<LangMix<WidgetBase>>>>>§
sourcepub fn font_family(&self, names: impl IntoVar<FontNames>)
pub fn font_family(&self, names: impl IntoVar<FontNames>)
P
Font family name or list of names for texts in this widget or descendants.
All fonts in the list are resolved according to the font_style
, font_weight
and font_stretch
config.
During text shaping the first font on the list is preferred, but if the font does not cover a character or word, that
character or word to the second font in the list and so on.
Sets the FONT_FAMILY_VAR
.
sourcepub fn font_size(&self, size: impl IntoVar<Length>)
pub fn font_size(&self, size: impl IntoVar<Length>)
P
Sets the font size for the widget and descendants.
This property affects all texts inside the widget and the Length::Em
unit.
Sets the FONT_SIZE_VAR
context var and the LayoutMetrics::font_size
.
sourcepub fn font_weight(&self, weight: impl IntoVar<FontWeight>)
pub fn font_weight(&self, weight: impl IntoVar<FontWeight>)
P
Defines the thickness or boldness the preferred font should have.
This value influences font resolution, the variant within the font family that is closest to this config will be selected.
Sets the FONT_WEIGHT_VAR
.
sourcepub fn font_style(&self, style: impl IntoVar<FontStyle>)
pub fn font_style(&self, style: impl IntoVar<FontStyle>)
P
Defines the skew style of the font glyphs.
This value influences font resolution, the variant within the font family that is closest to this config will be selected.
Sets the FONT_STYLE_VAR
.
sourcepub fn font_stretch(&self, stretch: impl IntoVar<FontStretch>)
pub fn font_stretch(&self, stretch: impl IntoVar<FontStretch>)
P
Defines how condensed or expanded the preferred font should be.
This value influences font resolution, the variant within the font family that is closest to this config will be selected.
Sets the FONT_STRETCH_VAR
.
sourcepub fn font_synthesis(&self, enabled: impl IntoVar<FontSynthesis>)
pub fn font_synthesis(&self, enabled: impl IntoVar<FontSynthesis>)
P
Configure if a synthetic font is generated for fonts that do not implement bold or oblique variants.
Not all fonts implement the requested font_weight
and font_style
, this config allows the renderer
to try and generate the style and weight anyway, using transforms and the glyph outlines.
Sets the FONT_SYNTHESIS_VAR
.
sourcepub fn font_aa(&self, aa: impl IntoVar<FontAntiAliasing>)
pub fn font_aa(&self, aa: impl IntoVar<FontAntiAliasing>)
P
Configure the anti-aliasing used to render text glyphs inside the widget.
Uses the operating system configuration by default.
Sets the FONT_AA_VAR
.
Trait Implementations§
source§impl Deref for AnsiText
impl Deref for AnsiText
source§type Target = FontMix<TextSpacingMix<ParagraphMix<LangMix<WidgetBase>>>>
type Target = FontMix<TextSpacingMix<ParagraphMix<LangMix<WidgetBase>>>>
Auto Trait Implementations§
impl !Freeze for AnsiText
impl !RefUnwindSafe for AnsiText
impl Send for AnsiText
impl !Sync for AnsiText
impl Unpin for AnsiText
impl !UnwindSafe for AnsiText
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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