Delay occurs while getting the size from the FormattedText
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
* .NET Core Version: .Net 6.0
* Windows version: Windows11- 22000.675
* Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
* Is this bug related specifically to tooling in Visual Studio -No
**Problem description:**
Delay Occurs while getting the size from the Formatted Text.
**Expected behavior:**
Delay should not be occured.
**Minimal repro:**
1.Run the sample
2.Click the Initialize Formatted Text button.
Note : Delay occurs, button is in pressed state for a long time.
Please refer the below code snippet and gif file.
```
private void Button_Click(object sender, RoutedEventArgs e)
{
for (int i = 0; i <= 30000; i++)
{
FormattedText text = new FormattedText("Demo", System.Globalization.CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface(FontFamily, new FontStyle(), FontWeights.Normal, FontStretch), 14, Brushes.Black);
Size demo = new Size(text.Width, text.Height);
}
MessageBox.Show("Initialized");
}
```

Contributor guide
Assessment
This issue has not been assessed yet.