TextLayout(String, Typeface, Double, IBrush, TextAlignment, TextWrapping, TextTrimming, TextDecorationCollection, FlowDirection, Double, Double, Double, Double, Int32, IReadOnlyList<ValueSpan<TextRunProperties>>) Constructor
Initializes a new instance of the TextLayout class.
Definition
Namespace: Avalonia.Media.TextFormatting
Assembly: Avalonia.Base (in Avalonia.Base.dll)
- C#
- VB
- F#
public TextLayout(
string? text,
Typeface typeface,
double fontSize,
IBrush? foreground,
TextAlignment textAlignment = TextAlignment.Left,
TextWrapping textWrapping = TextWrapping.NoWrap,
TextTrimming? textTrimming = null,
TextDecorationCollection? textDecorations = null,
FlowDirection flowDirection = FlowDirection.LeftToRight,
double maxWidth = ∞,
double maxHeight = ∞,
double lineHeight = NaN,
double letterSpacing = 0,
int maxLines = 0,
IReadOnlyList<ValueSpan<TextRunProperties>>? textStyleOverrides = null
)
Public Sub New (
text As String,
typeface As Typeface,
fontSize As Double,
foreground As IBrush,
Optional textAlignment As TextAlignment = TextAlignment.Left,
Optional textWrapping As TextWrapping = TextWrapping.NoWrap,
Optional textTrimming As TextTrimming = Nothing,
Optional textDecorations As TextDecorationCollection = Nothing,
Optional flowDirection As FlowDirection = FlowDirection.LeftToRight,
Optional maxWidth As Double = ∞,
Optional maxHeight As Double = ∞,
Optional lineHeight As Double = NaN,
Optional letterSpacing As Double = 0,
Optional maxLines As Integer = 0,
Optional textStyleOverrides As IReadOnlyList(Of ValueSpan(Of TextRunProperties)) = Nothing
)
new :
text : string *
typeface : Typeface *
fontSize : float *
foreground : IBrush *
?textAlignment : TextAlignment *
?textWrapping : TextWrapping *
?textTrimming : TextTrimming *
?textDecorations : TextDecorationCollection *
?flowDirection : FlowDirection *
?maxWidth : float *
?maxHeight : float *
?lineHeight : float *
?letterSpacing : float *
?maxLines : int *
?textStyleOverrides : IReadOnlyList<ValueSpan<TextRunProperties>>
(* Defaults:
let _textAlignment = defaultArg textAlignment TextAlignment.Left
let _textWrapping = defaultArg textWrapping TextWrapping.NoWrap
let _textTrimming = defaultArg textTrimming null
let _textDecorations = defaultArg textDecorations null
let _flowDirection = defaultArg flowDirection FlowDirection.LeftToRight
let _maxWidth = defaultArg maxWidth ∞
let _maxHeight = defaultArg maxHeight ∞
let _lineHeight = defaultArg lineHeight NaN
let _letterSpacing = defaultArg letterSpacing 0
let _maxLines = defaultArg maxLines 0
let _textStyleOverrides = defaultArg textStyleOverrides null
*)
-> TextLayout
Parameters
- String
- The text.
- Typeface
- The typeface.
- Double
- Size of the font.
- IBrush
- The foreground.
- TextAlignment (Optional)
- The text alignment.
- TextWrapping (Optional)
- The text wrapping.
- TextTrimming (Optional)
- The text trimming.
- TextDecorationCollection (Optional)
- The text decorations.
- FlowDirection (Optional)
- The text flow direction.
- Double (Optional)
- The maximum width.
- Double (Optional)
- The maximum height.
- Double (Optional)
- The height of each line of text.
- Double (Optional)
- The letter spacing that is applied to rendered glyphs.
- Int32 (Optional)
- The maximum number of text lines.
- IReadOnlyList(ValueSpan(TextRunProperties)) (Optional)
- The text style overrides.
See Also
Reference
TextLayout Class
TextLayout Overload
Avalonia.Media.TextFormatting Namespace