TextElement
struct · ferroui-controls · v0.5.0
struct TextElement
TextElement is the base class for content in text based controls.
It also defines the inherited font and foreground attached properties
used by every control that displays text.
This class is abstract.
Members
TYPEto_reflanguage_propertybackground_propertyfont_family_propertyfont_features_propertyfont_size_propertyfont_style_propertyfont_weight_propertyfont_stretch_propertyforeground_propertyletter_spacing_propertyfind_namelanguageset_languageresolved_languagehas_languagerun_cultureconstructbackgroundset_backgroundfont_familyset_font_familyfont_featuresset_font_featuresfont_sizeset_font_sizefont_styleset_font_stylefont_weightset_font_weightfont_stretchset_font_stretchforegroundset_foregroundletter_spacingset_letter_spacingget_font_familyset_font_family_onget_font_featuresset_font_features_onget_letter_spacingset_letter_spacing_onget_font_sizeset_font_size_onget_font_styleset_font_style_onget_font_weightset_font_weight_onget_font_stretchset_font_stretch_onget_foregroundset_foreground_on
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<TextElement>
Returns a strong reference to this object.
language_property
fn language_property() -> &'static AttachedProperty<Locale>
The inherited text language, a locale. Markup accepts a BCP-47
language tag (an IETF tag, as for a culture), and an empty tag (the
invariant culture, the unknown locale und) resolves to the preferred
application language when text is shaped. A locale is always a valid
XML language tag.
background_property
fn background_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
Defines the Background property.
font_family_property
fn font_family_property() -> &'static AttachedProperty<FontFamily>
Defines the FontFamily property.
font_features_property
fn font_features_property() -> &'static AttachedProperty<Option<FontFeatureCollection>>
Defines the FontFeatures property.
font_size_property
fn font_size_property() -> &'static AttachedProperty<f64>
Defines the FontSize property.
font_style_property
fn font_style_property() -> &'static AttachedProperty<FontStyle>
Defines the FontStyle property.
font_weight_property
fn font_weight_property() -> &'static AttachedProperty<FontWeight>
Defines the FontWeight property.
font_stretch_property
fn font_stretch_property() -> &'static AttachedProperty<FontStretch>
Defines the FontStretch property.
foreground_property
fn foreground_property() -> &'static AttachedProperty<Option<Rc<dyn IBrush>>>
Defines the Foreground property.
letter_spacing_property
fn letter_spacing_property() -> &'static AttachedProperty<f64>
Defines the LetterSpacing property.
find_name
fn find_name(self: &Self, name: &str) -> Option<Ref<FerroObject>>
Finds a registered object in this element's nearest logical name scope.
The result may be a control or another text element. A missing name or
name scope returns None. The nearest scope controls lookup, including
ChildNameScope's parent fallback after completion; no descendant tree
search or additional ancestor-scope search is performed here. XAML
registers names when it loads, while code-created content uses the
existing NameScope API. Each call follows the current parent chain.
Finds a named object in the nearest name scope of the element: a scope set on
the element or a logical ancestor, or, for an element in a control template,
the named parts of that template, as WinUI's TextElement.FindName finds
template names.
language
fn language(self: &Self) -> Locale
Gets the assigned or inherited language before empty-tag resolution.
set_language
fn set_language(self: &Self, value: Locale)
resolved_language
fn resolved_language(self: &Self) -> Locale
The language passed to font fallback and shaping for this element.
has_language
fn has_language(self: &Self) -> bool
Whether Language is set on this element or on an element it inherits from.
run_culture
fn run_culture(self: &Self) -> Option<Locale>
The culture of the text runs of this element: the resolved language when
Language is set on it or inherited from an element that sets it, else none.
Deviation (DEVIATIONS.md, Text block): Inline.CreateTextRunProperties passes no
culture; a run with a language gets it (WinUI's TextElement.Language), and one
without keeps upstream's None, so text with Inlines shapes as plain text.
construct
fn construct() -> Self
Creates the class data; see ferroui_base::FerroObject::construct.
background
fn background(self: &Self) -> Option<Rc<dyn IBrush>>
A brush used to paint the control's background.
set_background
fn set_background(self: &Self, value: Option<Rc<dyn IBrush>>)
font_family
fn font_family(self: &Self) -> FontFamily
The font family.
set_font_family
fn set_font_family(self: &Self, value: FontFamily)
font_features
fn font_features(self: &Self) -> Option<FontFeatureCollection>
The font features.
set_font_features
fn set_font_features(self: &Self, value: Option<FontFeatureCollection>)
font_size
fn font_size(self: &Self) -> f64
The font size.
set_font_size
fn set_font_size(self: &Self, value: f64)
font_style
fn font_style(self: &Self) -> FontStyle
The font style.
set_font_style
fn set_font_style(self: &Self, value: FontStyle)
font_weight
fn font_weight(self: &Self) -> FontWeight
The font weight.
set_font_weight
fn set_font_weight(self: &Self, value: FontWeight)
font_stretch
fn font_stretch(self: &Self) -> FontStretch
The font stretch.
set_font_stretch
fn set_font_stretch(self: &Self, value: FontStretch)
foreground
fn foreground(self: &Self) -> Option<Rc<dyn IBrush>>
A brush used to paint the text.
set_foreground
fn set_foreground(self: &Self, value: Option<Rc<dyn IBrush>>)
letter_spacing
fn letter_spacing(self: &Self) -> f64
The letter spacing.
set_letter_spacing
fn set_letter_spacing(self: &Self, value: f64)
get_font_family
fn get_font_family(control: &Control) -> FontFamily
Gets the value of the attached FontFamily property on a control.
set_font_family_on
fn set_font_family_on(control: &Control, value: FontFamily)
Sets the value of the attached FontFamily property on a control.
get_font_features
fn get_font_features(control: &Control) -> Option<FontFeatureCollection>
Gets the value of the attached FontFeatures property on a control.
set_font_features_on
fn set_font_features_on(control: &Control, value: Option<FontFeatureCollection>)
Sets the value of the attached FontFeatures property on a control.
get_letter_spacing
fn get_letter_spacing(control: &Control) -> f64
Gets the value of the attached LetterSpacing property on a control.
set_letter_spacing_on
fn set_letter_spacing_on(control: &Control, value: f64)
Sets the value of the attached LetterSpacing property on a control.
get_font_size
fn get_font_size(control: &Control) -> f64
Gets the value of the attached FontSize property on a control.
set_font_size_on
fn set_font_size_on(control: &Control, value: f64)
Sets the value of the attached FontSize property on a control.
get_font_style
fn get_font_style(control: &Control) -> FontStyle
Gets the value of the attached FontStyle property on a control.
set_font_style_on
fn set_font_style_on(control: &Control, value: FontStyle)
Sets the value of the attached FontStyle property on a control.
get_font_weight
fn get_font_weight(control: &Control) -> FontWeight
Gets the value of the attached FontWeight property on a control.
set_font_weight_on
fn set_font_weight_on(control: &Control, value: FontWeight)
Sets the value of the attached FontWeight property on a control.
get_font_stretch
fn get_font_stretch(control: &Control) -> FontStretch
Gets the value of the attached FontStretch property on a control.
set_font_stretch_on
fn set_font_stretch_on(control: &Control, value: FontStretch)
Sets the value of the attached FontStretch property on a control.
get_foreground
fn get_foreground(control: &Control) -> Option<Rc<dyn IBrush>>
Gets the value of the attached Foreground property on a control.
set_foreground_on
fn set_foreground_on(control: &Control, value: Option<Rc<dyn IBrush>>)
Sets the value of the attached Foreground property on a control.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeTextElementImplExtBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyFerroObjectImplExtStyledElementImplExtClassDefaultsErasedDestructorIntoEitherDerefUpcast<T>Upcast<TextElement>StaticTypeObjectTypeSubclassable<T>StyledElementImplFerroObjectImplTextElementImpl
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.