Struct zng_wgt_text::FontMix
source · pub struct FontMix<P>(/* private fields */);
Expand description
m
Basic text font properties.
All properties in this mixin affects Text!
nodes inside the widget where they are set.
See also FontFeaturesMix<P>
for the other font properties.
Implementations§
source§impl FontMix<()>
impl FontMix<()>
sourcepub fn context_vars_set(set: &mut ContextValueSet)
pub fn context_vars_set(set: &mut ContextValueSet)
Insert context variables used by properties in this mix-in.
source§impl<P: WidgetImpl> FontMix<P>
impl<P: WidgetImpl> FontMix<P>
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
.
source§impl<P: WidgetImpl> FontMix<P>
impl<P: WidgetImpl> FontMix<P>
sourcepub fn font_size(&self, size: impl IntoVar<FontSize>)
pub fn font_size(&self, size: impl IntoVar<FontSize>)
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
.
source§impl<P: WidgetImpl> FontMix<P>
impl<P: WidgetImpl> FontMix<P>
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
.
source§impl<P: WidgetImpl> FontMix<P>
impl<P: WidgetImpl> FontMix<P>
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
.
source§impl<P: WidgetImpl> FontMix<P>
impl<P: WidgetImpl> FontMix<P>
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
.
source§impl<P: WidgetImpl> FontMix<P>
impl<P: WidgetImpl> FontMix<P>
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
.
source§impl<P: WidgetImpl> FontMix<P>
impl<P: WidgetImpl> FontMix<P>
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§
Auto Trait Implementations§
impl<P> Freeze for FontMix<P>where
P: Freeze,
impl<P> RefUnwindSafe for FontMix<P>where
P: RefUnwindSafe,
impl<P> Send for FontMix<P>where
P: Send,
impl<P> Sync for FontMix<P>where
P: Sync,
impl<P> Unpin for FontMix<P>where
P: Unpin,
impl<P> UnwindSafe for FontMix<P>where
P: UnwindSafe,
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