Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF application, fonts graphical error

Tags:

c#

wpf

I have application in C# WPF (.NET4, app runs on Windows XP Embedded) and it worked correct, but now I received screenshot and there are graphical errors around text. These errors are only around text, not button edge, nor Windows desktop.

Images: enter image description here

enter image description here

It is graphical error (hardware), or program error which can be repaired?

like image 849
user2696366 Avatar asked Aug 19 '13 12:08

user2696366


2 Answers

Try using:

TextOptions.TextFormattingMode="Display"

Which should use ClearType. Or you could try:

TextOptions.TextRenderingMode="Aliased"

..and see if you get better results

like image 123
sharpguru Avatar answered Nov 14 '22 23:11

sharpguru


WPF should try to use ClearType and anti-aliasing by default to give a smoothed look out of the box. It cannot be turned off WPF Anti aliasing workaround.

There's a lot going on behind anti-aliasing, like sub-pixel anti-aliasing. http://blogs.msdn.com/b/text/archive/2009/08/24/wpf-4-0-text-stack-improvements.aspx. Edges are often aliased with another algorithm, that is hardware accelerated too: edge anti-aliasing. That maybe the reason you don't have problems with edges. For performance purposes the system tries to be smart and use hardware acceleration (all modern GPUs provide such). The thing what you develop is for some kind of commercial touch screen device seemingly: like electronic information booth at plaza/mall, or some control terminal in a factory, or something. These usually can have weirdo hardware in them, exotic GPUs and motherboards. Vibration and environment impact (hot day - cold night temperature change recurrence) can cause them to have glitches and hardware failures.

  1. Try to run other software too on the device, which uses ClearType anti-aliasing like WPF does also. See if only your software causes that or not. See if other WPF software causes such.
  2. You can try to turn off hardware acceleration if you can on that system, and see if software rendering improves anything. http://blogs.msdn.com/b/text/archive/2006/10/18/tips-for-improving-your-wpf-text-rendering-experience.aspx Poke around in settings also.
  3. Try to run hardware diagnostics and GPU tests, depending on what you can get to the device.

I would rule out font file corruption: that would probably make the font completely unusable, and you also report that the weird look comes with other fonts too, I don't think that all of them is corrupted. Try to run diagnostics for software error though.

like image 28
Csaba Toth Avatar answered Nov 15 '22 00:11

Csaba Toth