|
|
|
@ -197,7 +197,7 @@ namespace Avalonia.Controls |
|
|
|
{ |
|
|
|
if (_formattedText == null) |
|
|
|
{ |
|
|
|
_formattedText = CreateFormattedText(_constraint); |
|
|
|
_formattedText = CreateFormattedText(_constraint, Text); |
|
|
|
} |
|
|
|
|
|
|
|
return _formattedText; |
|
|
|
@ -348,14 +348,15 @@ namespace Avalonia.Controls |
|
|
|
/// Creates the <see cref="FormattedText"/> used to render the text.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="constraint">The constraint of the text.</param>
|
|
|
|
/// <param name="text">The text to generated the <see cref="FormattedText"/> for.</param>
|
|
|
|
/// <returns>A <see cref="FormattedText"/> object.</returns>
|
|
|
|
protected virtual FormattedText CreateFormattedText(Size constraint) |
|
|
|
protected virtual FormattedText CreateFormattedText(Size constraint, string text) |
|
|
|
{ |
|
|
|
return new FormattedText |
|
|
|
{ |
|
|
|
Constraint = constraint, |
|
|
|
Typeface = new Typeface(FontFamily, FontSize, FontStyle, FontWeight), |
|
|
|
Text = Text ?? string.Empty, |
|
|
|
Text = text ?? string.Empty, |
|
|
|
TextAlignment = TextAlignment, |
|
|
|
Wrapping = TextWrapping, |
|
|
|
}; |
|
|
|
|