diff --git a/src/Avalonia.Controls/Presenters/TextPresenter.cs b/src/Avalonia.Controls/Presenters/TextPresenter.cs index 00b2ed2149..fbdf885709 100644 --- a/src/Avalonia.Controls/Presenters/TextPresenter.cs +++ b/src/Avalonia.Controls/Presenters/TextPresenter.cs @@ -275,7 +275,7 @@ namespace Avalonia.Controls.Presenters Typeface = new Typeface(FontFamily, FontSize, FontStyle, FontWeight), TextAlignment = TextAlignment, Constraint = availableSize, - }.Measure().Size; + }.Bounds.Size; } } diff --git a/src/Avalonia.Controls/TextBlock.cs b/src/Avalonia.Controls/TextBlock.cs index 2ccab016f2..6b0c48b97b 100644 --- a/src/Avalonia.Controls/TextBlock.cs +++ b/src/Avalonia.Controls/TextBlock.cs @@ -396,7 +396,7 @@ namespace Avalonia.Controls FormattedText.Constraint = Size.Infinity; } - return FormattedText.Measure().Size; + return FormattedText.Bounds.Size; } return new Size(); diff --git a/src/Avalonia.Visuals/Media/FormattedText.cs b/src/Avalonia.Visuals/Media/FormattedText.cs index 7abf8465a7..e20e03e296 100644 --- a/src/Avalonia.Visuals/Media/FormattedText.cs +++ b/src/Avalonia.Visuals/Media/FormattedText.cs @@ -37,6 +37,12 @@ namespace Avalonia.Media _platform = platform; } + /// + /// Gets the bounds of the text within the . + /// + /// The bounds of the text. + public Rect Bounds => PlatformImpl.Bounds; + /// /// Gets or sets the constraint of the text. /// @@ -158,12 +164,6 @@ namespace Avalonia.Media return PlatformImpl.HitTestTextRange(index, length); } - /// - /// Gets the bounds of the text, taking into account. - /// - /// The bounds of the text. - public Rect Measure() => PlatformImpl.Bounds; - private void Set(ref T field, T value) { field = value; diff --git a/src/Avalonia.Visuals/Rendering/RendererBase.cs b/src/Avalonia.Visuals/Rendering/RendererBase.cs index ed464ec7f9..7b10fc1212 100644 --- a/src/Avalonia.Visuals/Rendering/RendererBase.cs +++ b/src/Avalonia.Visuals/Rendering/RendererBase.cs @@ -45,7 +45,7 @@ namespace Avalonia.Rendering _fpsText.Text = string.Format("FPS: {0:000}", _fps); } - var size = _fpsText.Measure(); + var size = _fpsText.Bounds.Size; var rect = new Rect(clientRect.Right - size.Width, 0, size.Width, size.Height); context.Transform = Matrix.Identity;