Project

General

Profile

Bug #12003

text rendering / cleartype issue on windows

Added by Thomas cygn 8 months ago. Updated 7 months ago.

Status:
Closed: upstream
Priority:
Low
Assignee:
-
Category:
Darkroom
Target version:
Start date:
02/08/2018
Due date:
% Done:

0%

Affected Version:
2.4.1
System:
Windows
bitness:
64-bit
hardware architecture:
amd64/x86

Description

The text rendering in the UI looks wrong for me in Windows 10. The letters all have colourful pixels at the borders and it's hurting my eyes seeing it.
I tried disabling cleartype, and it does change how the text is rendered. The colourful pixels disappear, but then it looks bad in a different way.
Other apps on Windows look good, even ones with a dark background

darktable-cleartype-on.PNG - cleartype on (193 KB) Thomas cygn, 02/08/2018 05:39 PM

darktable-cleartype-off.png - cleartype off (223 KB) Thomas cygn, 02/08/2018 05:39 PM

Capture - Cleartype.PNG (932 KB) Peter Budai, 02/09/2018 05:31 PM

smooth_edges_off.png (81.3 KB) Thomas cygn, 02/09/2018 08:34 PM

darktable-remotedesktop.png (294 KB) Thomas cygn, 02/09/2018 08:34 PM

performance-settings.png (24.5 KB) Thomas cygn, 02/09/2018 08:34 PM

darktable_fontconfig.zip - fontconfig solution (1.43 MB) Thomas cygn, 02/11/2018 04:26 PM

darktable-fontconfig.png (382 KB) Thomas cygn, 02/11/2018 04:29 PM

History

#1 Updated by Peter Budai 7 months ago

That looks really painful. I have no problem with cleartype at all - see the attached file

  • Is this happening on a specific monitor or on all monitors you hook your machine to?
  • What is your screen's native resolution?
  • What is the resolution you use on that screen?
  • What is the scale you use at the display settings?
  • What are your settings at Performance Options/Visual Effects? Especially what is your setting for "Smooth edges of screen fonts"?

#2 Updated by Thomas cygn 7 months ago

Peter Budai wrote:

That looks really painful. I have no problem with cleartype at all - see the attached file

  • Is this happening on a specific monitor or on all monitors you hook your machine to?

I only have this display. I did install darktable on my Surface Pro 2 and it looks good there,
like in your screenshot. I also logged in via remote desktop from the surface to my desktop.
Then it looks blurry but also with colourful edges. See screenshot.

  • What is your screen's native resolution?

2560x1600

  • What is the resolution you use on that screen?

2560x1600

  • What is the scale you use at the display settings?

100%

  • What are your settings at Performance Options/Visual Effects? Especially what is your setting for "Smooth edges of screen fonts"?

It's turned on (Kanten der Bildschirmschriftarten verfeinern). Everything is default/optimized.
If I turn it off, it looks quite good in darktable, but obviously not everywhere else. See screenshot. If I cood at least turn it off only for darktable, that would be an improvement.

#3 Updated by Peter Budai 7 months ago

Smooth edges should be turned on - at least is working fine here.

I run out of ideas.

#4 Updated by Thomas cygn 7 months ago

I guess that cleartype is rendering the text without seeing the correct background. Maybe the text is rendered on a black background and then the bitmap is put over the real background with black pixels considered transparent?
The reason it works on some computers is probably, that cleartype is configured for a particular display. Maybe some displays have their subpixels aligned in such a way, so that it doesn't matter if the text was rendered on the wrong background.
Here's some more background info: https://blogs.msdn.microsoft.com/oldnewthing/20150129-00/?p=44803

I would like to have a quick look in the code where the text is being rendered, but I don't know where to look.

#5 Updated by Tobias Ellinghaus 7 months ago

  • Status changed from New to Closed: upstream

Since it also affects standard GTK labels that's most likely a bug in GTK.

#6 Updated by Thomas cygn 7 months ago

I did find a nice solution to this problem after all, which I'm going to explain now:
So the text rendering in GTK is done with Pango and Cairo. It turns out, there's an environmental variable PANGOCAIRO_BACKEND which allows us to set which backend is used for font rendering. Possible values include win32, fontconfig, coretext and quartz. Win32 means, the font rendering is done using whatever Windows uses, i.e. Cleartype in my case. In the case of fontconfig the linux solution freetype is used instead. Freetype can also do subpixel antialiasing.
So I tried setting PANGOCAIRO_BACKEND to fontconfig. Unfortunately the result I got was all text was replaced by empty boxes. It turns out I also need to set the env. variable FONTCONFIG_PATH to a directory containing a font.cfg file, pointing to a directory with some fonts.
When I did that and when I configured a mapping from Sans to DejaVu Sans everything looked pretty smooth:

I'm not 100% sure if other fonts have to be provided as well. Some of the .css files suggest I might have to provide other fonts as well.
I attached a batch file which sets the env. variables and the fonts/font.cfg file.
There might be a better way to integrate this in darktable. Maybe add an option where you can select the font rendering backend?

Also available in: Atom PDF