FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    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.

    View source

    Members

    TYPE

    const TYPE: &'static $crate::TypeInfo
    

    The runtime type of this class.

    Source

    to_ref

    fn to_ref(self: &Self) -> $crate::Ref<TextElement>
    

    Returns a strong reference to this object.

    Source

    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.

    Source

    background_property

    fn background_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
    

    Defines the Background property.

    Source

    font_family_property

    fn font_family_property() -> &'static AttachedProperty<FontFamily>
    

    Defines the FontFamily property.

    Source

    font_features_property

    fn font_features_property() -> &'static AttachedProperty<Option<FontFeatureCollection>>
    

    Defines the FontFeatures property.

    Source

    font_size_property

    fn font_size_property() -> &'static AttachedProperty<f64>
    

    Defines the FontSize property.

    Source

    font_style_property

    fn font_style_property() -> &'static AttachedProperty<FontStyle>
    

    Defines the FontStyle property.

    Source

    font_weight_property

    fn font_weight_property() -> &'static AttachedProperty<FontWeight>
    

    Defines the FontWeight property.

    Source

    font_stretch_property

    fn font_stretch_property() -> &'static AttachedProperty<FontStretch>
    

    Defines the FontStretch property.

    Source

    foreground_property

    fn foreground_property() -> &'static AttachedProperty<Option<Rc<dyn IBrush>>>
    

    Defines the Foreground property.

    Source

    letter_spacing_property

    fn letter_spacing_property() -> &'static AttachedProperty<f64>
    

    Defines the LetterSpacing property.

    Source

    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.

    Source

    language

    fn language(self: &Self) -> Locale
    

    Gets the assigned or inherited language before empty-tag resolution.

    Source

    set_language

    fn set_language(self: &Self, value: Locale)
    

    Source

    resolved_language

    fn resolved_language(self: &Self) -> Locale
    

    The language passed to font fallback and shaping for this element.

    Source

    has_language

    fn has_language(self: &Self) -> bool
    

    Whether Language is set on this element or on an element it inherits from.

    Source

    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.

    Source

    construct

    fn construct() -> Self
    

    Creates the class data; see ferroui_base::FerroObject::construct.

    Source

    background

    fn background(self: &Self) -> Option<Rc<dyn IBrush>>
    

    A brush used to paint the control's background.

    Source

    set_background

    fn set_background(self: &Self, value: Option<Rc<dyn IBrush>>)
    

    Source

    font_family

    fn font_family(self: &Self) -> FontFamily
    

    The font family.

    Source

    set_font_family

    fn set_font_family(self: &Self, value: FontFamily)
    

    Source

    font_features

    fn font_features(self: &Self) -> Option<FontFeatureCollection>
    

    The font features.

    Source

    set_font_features

    fn set_font_features(self: &Self, value: Option<FontFeatureCollection>)
    

    Source

    font_size

    fn font_size(self: &Self) -> f64
    

    The font size.

    Source

    set_font_size

    fn set_font_size(self: &Self, value: f64)
    

    Source

    font_style

    fn font_style(self: &Self) -> FontStyle
    

    The font style.

    Source

    set_font_style

    fn set_font_style(self: &Self, value: FontStyle)
    

    Source

    font_weight

    fn font_weight(self: &Self) -> FontWeight
    

    The font weight.

    Source

    set_font_weight

    fn set_font_weight(self: &Self, value: FontWeight)
    

    Source

    font_stretch

    fn font_stretch(self: &Self) -> FontStretch
    

    The font stretch.

    Source

    set_font_stretch

    fn set_font_stretch(self: &Self, value: FontStretch)
    

    Source

    foreground

    fn foreground(self: &Self) -> Option<Rc<dyn IBrush>>
    

    A brush used to paint the text.

    Source

    set_foreground

    fn set_foreground(self: &Self, value: Option<Rc<dyn IBrush>>)
    

    Source

    letter_spacing

    fn letter_spacing(self: &Self) -> f64
    

    The letter spacing.

    Source

    set_letter_spacing

    fn set_letter_spacing(self: &Self, value: f64)
    

    Source

    get_font_family

    fn get_font_family(control: &Control) -> FontFamily
    

    Gets the value of the attached FontFamily property on a control.

    Source

    set_font_family_on

    fn set_font_family_on(control: &Control, value: FontFamily)
    

    Sets the value of the attached FontFamily property on a control.

    Source

    get_font_features

    fn get_font_features(control: &Control) -> Option<FontFeatureCollection>
    

    Gets the value of the attached FontFeatures property on a control.

    Source

    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.

    Source

    get_letter_spacing

    fn get_letter_spacing(control: &Control) -> f64
    

    Gets the value of the attached LetterSpacing property on a control.

    Source

    set_letter_spacing_on

    fn set_letter_spacing_on(control: &Control, value: f64)
    

    Sets the value of the attached LetterSpacing property on a control.

    Source

    get_font_size

    fn get_font_size(control: &Control) -> f64
    

    Gets the value of the attached FontSize property on a control.

    Source

    set_font_size_on

    fn set_font_size_on(control: &Control, value: f64)
    

    Sets the value of the attached FontSize property on a control.

    Source

    get_font_style

    fn get_font_style(control: &Control) -> FontStyle
    

    Gets the value of the attached FontStyle property on a control.

    Source

    set_font_style_on

    fn set_font_style_on(control: &Control, value: FontStyle)
    

    Sets the value of the attached FontStyle property on a control.

    Source

    get_font_weight

    fn get_font_weight(control: &Control) -> FontWeight
    

    Gets the value of the attached FontWeight property on a control.

    Source

    set_font_weight_on

    fn set_font_weight_on(control: &Control, value: FontWeight)
    

    Sets the value of the attached FontWeight property on a control.

    Source

    get_font_stretch

    fn get_font_stretch(control: &Control) -> FontStretch
    

    Gets the value of the attached FontStretch property on a control.

    Source

    set_font_stretch_on

    fn set_font_stretch_on(control: &Control, value: FontStretch)
    

    Sets the value of the attached FontStretch property on a control.

    Source

    get_foreground

    fn get_foreground(control: &Control) -> Option<Rc<dyn IBrush>>
    

    Gets the value of the attached Foreground property on a control.

    Source

    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.

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.