diff --git a/src/Avalonia.Visuals/Media/TextFormatting/TextLayout.cs b/src/Avalonia.Visuals/Media/TextFormatting/TextLayout.cs
index f01ef886f7..e3b14a5ac3 100644
--- a/src/Avalonia.Visuals/Media/TextFormatting/TextLayout.cs
+++ b/src/Avalonia.Visuals/Media/TextFormatting/TextLayout.cs
@@ -35,10 +35,10 @@ namespace Avalonia.Media.TextFormatting
/// The maximum number of text lines.
/// The text style overrides.
public TextLayout(
- string text,
+ string? text,
Typeface typeface,
double fontSize,
- IBrush foreground,
+ IBrush? foreground,
TextAlignment textAlignment = TextAlignment.Left,
TextWrapping textWrapping = TextWrapping.NoWrap,
TextTrimming textTrimming = TextTrimming.None,
@@ -478,7 +478,7 @@ namespace Avalonia.Media.TextFormatting
/// The height of each line of text.
///
private static TextParagraphProperties CreateTextParagraphProperties(Typeface typeface, double fontSize,
- IBrush foreground, TextAlignment textAlignment, TextWrapping textWrapping,
+ IBrush? foreground, TextAlignment textAlignment, TextWrapping textWrapping,
TextDecorationCollection? textDecorations, FlowDirection flowDirection, double lineHeight)
{
var textRunStyle = new GenericTextRunProperties(typeface, fontSize, textDecorations, foreground);