FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    CharacterFormat

    struct · ferroui-controls · v0.5.0

    struct CharacterFormat
    

    A character-format patch, also used to capture the assigned formatting of an element. None leaves a property unchanged. For nullable properties, Some(None) explicitly clears it. Snapshots copy mutable formatting collections.

    View source

    Members

    language

    language: Option<ferroui_base::utilities::Locale>
    

    Source

    font_family

    font_family: Option<ferroui_base::media::FontFamily>
    

    Source

    font_size

    font_size: Option<f64>
    

    Source

    font_style

    font_style: Option<ferroui_base::media::FontStyle>
    

    Source

    font_weight

    font_weight: Option<ferroui_base::media::FontWeight>
    

    Source

    font_stretch

    font_stretch: Option<ferroui_base::media::FontStretch>
    

    Source

    font_features

    font_features: Option<Option<ferroui_base::media::FontFeatureCollection>>
    

    Source

    typography

    typography: super::TypographyFormat
    

    Each assigned typography field is patched independently. Effective formats contain all resolved values, including explicit defaults.

    Source

    foreground

    foreground: Option<Option<std::rc::Rc<dyn IBrush>>>
    

    Source

    background

    background: Option<Option<std::rc::Rc<dyn IBrush>>>
    

    Source

    text_decorations

    text_decorations: Option<Option<ferroui_base::media::TextDecorationCollection>>
    

    Source

    baseline_alignment

    baseline_alignment: Option<ferroui_base::media::BaselineAlignment>
    

    Source

    letter_spacing

    letter_spacing: Option<f64>
    

    Source

    from_element

    fn from_element(element: &TextElement) -> Self
    

    Captures assigned properties without flattening inherited span formatting.

    Source

    effective

    fn effective(element: &TextElement) -> Self
    

    Captures computed values, including formatting inherited through logical parents.

    Source

    overlay

    fn overlay(self: &Self, patch: &Self) -> Self
    

    Returns this format with every assigned field of patch replaced.

    Source

    validate

    fn validate(self: &Self) -> Result<(), super::DocumentError>
    

    Whether the assigned values are valid. A language is a locale, which is always a valid XML language tag.

    Source

    try_apply_to

    fn try_apply_to(self: &Self, element: &TextElement) -> Result<(), super::DocumentError>
    

    Source

    language_tag

    fn language_tag(self: &Self) -> Option<String>
    

    The assigned native LanguageTag value: the BCP-47 tag of the locale, empty for the invariant culture (the unknown locale und). None means that this patch leaves language unchanged; mixed range values use TextFormatValue as usual.

    Source

    set_language_tag

    fn set_language_tag(self: &mut Self, tag: &str) -> Result<(), super::DocumentError>
    

    Assigns the language of a tag without modifying any other character formatting: the empty tag is the invariant culture (the unknown locale und), any other tag has to be a valid XML language tag and a BCP-47 language tag (the locale holds it with the case of its subtags normalized). Validation completes before this patch changes.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • PropertyValue
    • AnyValue
    • ClassDefaults
    • ErasedDestructor
    • IntoEither
    • Default
    • Debug
    • Clone
    • PartialEq

    Availability

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