TextElementFormatting Struct
Definition
Formatting snapshot for properties defined on Avalonia.Controls.Documents.RichTextElement. Shared across all node types (inline, block, table row, etc.).
public struct TextElementFormatting
Remarks
Captures the inheritable visual properties that every Avalonia.Controls.Documents.RichTextElement can carry: font family/size/weight/style/stretch, foreground, background, letter spacing, and font features. Avalonia.Controls.Documents.TextModel.Formatting.InlineFormatting and Avalonia.Controls.Documents.TextModel.Formatting.BlockFormatting carry only what is specific to them.
Stored on Avalonia.Controls.Documents.Serialization.Snapshot.SnapshotNode so every snapshot node (inline, block, table-row, image, etc.) can carry base-level formatting without type-specific snapshot subclasses.
Methods
| Name | Description |
|---|---|
| Equals (2 overloads) | No summary available. |
| GetHashCode | No summary available. |
| ToString | No summary available. |
Equals overloads
Equals Method
public bool Equals(Avalonia.Controls.Documents.TextModel.Formatting.TextElementFormatting other)
Parameters
other Avalonia.Controls.Documents.TextModel.Formatting.TextElementFormatting
Returns
bool
Equals Method
public bool Equals(object obj)
Parameters
obj object
Returns
bool
GetHashCode Method
public int GetHashCode()
Returns
int
ToString Method
public string ToString()
Returns
string
Properties
| Name | Description |
|---|---|
| BackgroundArgb | Packed ARGB value for background color. Null means not explicitly set. |
| BackgroundColor | Gets the background color if set, otherwise null. |
| Default | Default formatting with no explicit values set. |
| FontFamily | The font family name. Null if using inherited/default font. |
| FontFeatures | OpenType font features (e.g. ligatures, stylistic sets). Default means not explicitly set. |
| FontSize | The font size in device-independent pixels. Null means not explicitly set. |
| FontStretch | The font stretch (e.g., Normal, Condensed, Expanded). Null means not explicitly set. |
| FontStyle | The font style (e.g., Normal, Italic, Oblique). Null means not explicitly set. |
| FontWeight | The font weight (e.g., Normal, Bold). Null means not explicitly set. |
| ForegroundArgb | Packed ARGB value for foreground color. Null means not explicitly set. |
| ForegroundColor | Gets the foreground color if set, otherwise null. |
| HasBackground | Gets whether a background color is explicitly set. |
| HasForeground | Gets whether a foreground color is explicitly set. |
| LetterSpacing | The letter spacing in pixels. Null means not explicitly set. Default is 0 (normal spacing). |
BackgroundArgb Property
Packed ARGB value for background color. Null means not explicitly set.
public Nullable<uint> BackgroundArgb { get; set; }
BackgroundColor Property
Gets the background color if set, otherwise null.
public Nullable<Avalonia.Media.Color> BackgroundColor { get; set; }
Default Property
Default formatting with no explicit values set.
public Avalonia.Controls.Documents.TextModel.Formatting.TextElementFormatting Default { get; set; }
FontFamily Property
The font family name. Null if using inherited/default font.
public string FontFamily { get; set; }
FontFeatures Property
OpenType font features (e.g. ligatures, stylistic sets). Default means not explicitly set.
public Avalonia.Media.FontFeature[] FontFeatures { get; set; }
Remarks
Do not write through this array. A snapshot is read by a serializer running on another thread while the document carries on being edited, and the array is handed out by reference, so a write here is a write the reader may see halfway through. Build a new array and assign it instead.
FontSize Property
The font size in device-independent pixels. Null means not explicitly set.
public Nullable<double> FontSize { get; set; }
FontStretch Property
The font stretch (e.g., Normal, Condensed, Expanded). Null means not explicitly set.
public Nullable<Avalonia.Media.FontStretch> FontStretch { get; set; }
FontStyle Property
The font style (e.g., Normal, Italic, Oblique). Null means not explicitly set.
public Nullable<Avalonia.Media.FontStyle> FontStyle { get; set; }
FontWeight Property
The font weight (e.g., Normal, Bold). Null means not explicitly set.
public Nullable<Avalonia.Media.FontWeight> FontWeight { get; set; }
ForegroundArgb Property
Packed ARGB value for foreground color. Null means not explicitly set.
public Nullable<uint> ForegroundArgb { get; set; }
ForegroundColor Property
Gets the foreground color if set, otherwise null.
public Nullable<Avalonia.Media.Color> ForegroundColor { get; set; }
HasBackground Property
Gets whether a background color is explicitly set.
public bool HasBackground { get; set; }
HasForeground Property
Gets whether a foreground color is explicitly set.
public bool HasForeground { get; set; }
LetterSpacing Property
The letter spacing in pixels. Null means not explicitly set. Default is 0 (normal spacing).
public Nullable<double> LetterSpacing { get; set; }