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.
Members
languagefont_familyfont_sizefont_stylefont_weightfont_stretchfont_featurestypographyforegroundbackgroundtext_decorationsbaseline_alignmentletter_spacingfrom_elementeffectiveoverlayvalidatetry_apply_tolanguage_tagset_language_tag
language
language: Option<ferroui_base::utilities::Locale>
font_family
font_family: Option<ferroui_base::media::FontFamily>
font_size
font_size: Option<f64>
font_style
font_style: Option<ferroui_base::media::FontStyle>
font_weight
font_weight: Option<ferroui_base::media::FontWeight>
font_stretch
font_stretch: Option<ferroui_base::media::FontStretch>
font_features
font_features: Option<Option<ferroui_base::media::FontFeatureCollection>>
typography
typography: super::TypographyFormat
Each assigned typography field is patched independently. Effective formats contain all resolved values, including explicit defaults.
foreground
foreground: Option<Option<std::rc::Rc<dyn IBrush>>>
background
background: Option<Option<std::rc::Rc<dyn IBrush>>>
text_decorations
text_decorations: Option<Option<ferroui_base::media::TextDecorationCollection>>
baseline_alignment
baseline_alignment: Option<ferroui_base::media::BaselineAlignment>
letter_spacing
letter_spacing: Option<f64>
from_element
fn from_element(element: &TextElement) -> Self
Captures assigned properties without flattening inherited span formatting.
effective
fn effective(element: &TextElement) -> Self
Captures computed values, including formatting inherited through logical parents.
overlay
fn overlay(self: &Self, patch: &Self) -> Self
Returns this format with every assigned field of patch replaced.
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.
try_apply_to
fn try_apply_to(self: &Self, element: &TextElement) -> Result<(), super::DocumentError>
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.
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.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedPropertyValueAnyValueClassDefaultsErasedDestructorIntoEitherDefaultDebugClonePartialEq
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.