Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WPF] Text randomly disappears in high resolution images #2477

Open
Serg-Norseman opened this issue May 18, 2023 · 3 comments
Open

[WPF] Text randomly disappears in high resolution images #2477

Serg-Norseman opened this issue May 18, 2023 · 3 comments

Comments

@Serg-Norseman
Copy link
Contributor

I ran into a problem similar to the one described in the article:
https://social.msdn.microsoft.com/Forums/en-US/98717e53-89f7-4d5f-823b-7184781a7b85/wpf-formattedtext-randomly-disappears-in-high-resolution-images

I am rendering a very large chart: over 23k pixels wide. Lines, shapes and images are displayed correctly, but the output text disappears randomly, depending on the font size. For example, half of the image - the text is all there, and starting from the middle in width - all the text is missing. The font size is the same everywhere.

Specifications

  • Version: 2.7.4
  • Platform(s): WPF
  • Operating System(s): Windows 10
@cwensley
Copy link
Member

Hey @Serg-Norseman, thanks for reporting the issue.

I'm not sure how to fix this if it's a problem with WPF itself? A few things:

  1. Have you tried using .NET Core vs. .NET Framework as they have more fixes there?
  2. Perhaps try enabling GDI text display mode like here, which changes how text is rendered in WPF.
  3. Might be good to create an issue over at https://github.com/dotnet/wpf for this to get it in front of the devs responsible.

Hope this helps!

@Serg-Norseman
Copy link
Contributor Author

Thank you!

I will definitely try rendering with GDI enabled.

Now my application is built on the basis of Eto 2.7.5 and NET6. With drawing text in a large chart (from 20 to 50 thousand pixels), two recommendations from the article helped me: a strange advice for me to use rounding the font size to 2 decimal places (helped partially) and setting the lower limit of the font size (helped completely, the text began to be displayed in all areas of the diagram). I'll also try GDI, because in the old WinForms-based application, the whole diagram was drawn completely without any problems and with smaller fonts.

@Serg-Norseman
Copy link
Contributor Author

But with the use of GDI, another problem can arise: all of the above rarely occurs when rendering to a component on the screen and always when I redirect the output from the screen to a separate Bitmap for saving to disk.

How to execute TextOptions.SetTextFormattingMode(handler.Control, TextFormattingMode.Display) for Bitmap/Graphics without binding to controls?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants