GNOME Bugzilla – Bug 657047
System configuration's subpixel rendering is used for rendering text
Last modified: 2018-01-20 20:42:02 UTC
If the subpixel rendering is enabled on system — e.g in ~/.fonts.conf with <edit mode="assign" name="rgba"><const>rgb</const></edit> — then attempts to write some text, e.g. in orange color — will leave visible colored subpixel rendering artifacts on the sides of the letters, which can look weird, especially when zoomed in. While it may be successfully argued that gimp is just obeying system preferences for the selected font, this also means that the same file with unrasterized text with same settings in xcf, with the same font, with same almost everything — may still look vastly different on other system, which I'd argue is a bad thing. I'd suggest not using subpixel rendering for text output at all — it and its settings are absolutely dependant on the exact monitor the text is viewed on — or to move it to an option like "antialias" already is (but I can't imagine a good use case where this would be helpful).
Is this the same as bug #647313?
Yes, it is indeed.
*** Bug 647313 has been marked as a duplicate of this bug. ***
*** This bug has been marked as a duplicate of bug 647313 ***
Created attachment 195548 [details] GIMP screenshot I can confirm this bug, screenshot attached. And I would not call it a «minor» bug… GIMP version 2.7.3
Created attachment 195777 [details] [review] Proposed patch Could anybody that is experiencing the problem, please, test the attached patch and report whether it fixes the problem?
It doesn't help. By the quick glance over some bug reports, it looks like a conceptual design choice of cairo: users' font settings have an explicit priority over the settings requested by the application: https://bugs.freedesktop.org/show_bug.cgi?id=4792 https://bugs.freedesktop.org/show_bug.cgi?id=11838
If that's the case it is wrong because the output of cairo is not going directly to the screen, but it is a layer in a stack of layers that are combined together according to different rules, none of which take in consideration subpixel rendering. Neither does a GIMP's filter applied to it. When different results on different platforms will be observed it will be GIMP's fault.
I can confirm this bug with GIMP 2.8. Here's a screenshot: http://colin.net.pl/narf/gimp2.8_subpixel_bug.png. Also Massimo's patch doesn't fix this. Please tell me if I should add any additional details.
From #cairo on freenode: 22:39 < schumaml> hi, is there a way to prevent subpixel rendering when adding text to an image in gimp - see https://bugzilla.gnome.org/show_bug.cgi?id=657047 for details about how cairo is invovled 22:43 < ickle> cairo_set_antialias(GRAY), cairo_font_options_set_antialias(GRAY)
at least one of those has been tried unsuccessfully
*** Bug 676312 has been marked as a duplicate of this bug. ***
*** Bug 678746 has been marked as a duplicate of this bug. ***
*** Bug 683330 has been marked as a duplicate of this bug. ***
Is there any update here? I saw Michael Natterer state in bug #683330 that it's a system misconfiguration. If that's the case then this should be closed but I'd also like some more details. Where in the configuration would the problem lie? I've looked through /etc/fonts and I can't see anything relevant. I am running Gentoo and I believe I am using the default font configuration so does that mean it is a Gentoo bug?
We don't know. We asked the fontconfig people and were told it's a system config problem. It has never happened on my machine (debian unstable), and not for many others either. Please ask fontconfig. Finally closing as NOTGNOME because we can't do anything about it.
*** Bug 731944 has been marked as a duplicate of this bug. ***
*** Bug 739860 has been marked as a duplicate of this bug. ***
I think that this bug should be reopened because I think it definitely is a problem with GIMP, since I tried typing a white text on white background with Krita and there it works... So, I suppose, this means that it's not a problem of fontconfig... I will attach a screenshot of the text with GIMP and Krita. (Please, see BUG 746791)
Created attachment 300848 [details] Comparison My Comparison on the same system between Krita and GIMP
Does Krita use fontconfig?
*** Bug 746791 has been marked as a duplicate of this bug. ***
Created attachment 300871 [details] GPaint is not affected I don't know about Krita (since it is a Qt/KDE app), but GPaint which uses GTK and pango seems to be not affected by this bug... (and I presume that it uses fontconfig)
Do Krita and GPaint also use pango-cairo? Because that's what's affected by the problem.
I don't know how to check this precisely, I tried with ldd: GPaint: ldd `which gpaint` | grep 'pango\|cairo' libcairo.so.2 => /usr/lib/libcairo.so.2 (0x00007fa37f210000) libpango-1.0.so.0 => /usr/lib/libpango-1.0.so.0 (0x00007fa37ed9e000) libpangocairo-1.0.so.0 => /usr/lib/libpangocairo-1.0.so.0 (0x00007fa37df2a000) libpangoft2-1.0.so.0 => /usr/lib/libpangoft2-1.0.so.0 (0x00007fa37d99e000) Krita: ldd `which krita` | grep 'pango\|cairo' Nothing. Here is the complete ldd: GPaint: ldd `which gpaint` linux-vdso.so.1 (0x00007ffeb21f7000) libm.so.6 => /usr/lib/libm.so.6 (0x00007f4483554000) libglade-2.0.so.0 => /usr/lib/libglade-2.0.so.0 (0x00007f4483339000) libgtk-x11-2.0.so.0 => /usr/lib/libgtk-x11-2.0.so.0 (0x00007f4482cf7000) libgdk-x11-2.0.so.0 => /usr/lib/libgdk-x11-2.0.so.0 (0x00007f4482a41000) libatk-1.0.so.0 => /usr/lib/libatk-1.0.so.0 (0x00007f448281b000) libcairo.so.2 => /usr/lib/libcairo.so.2 (0x00007f44824eb000) libgdk_pixbuf-2.0.so.0 => /usr/lib/libgdk_pixbuf-2.0.so.0 (0x00007f44822c5000) libpango-1.0.so.0 => /usr/lib/libpango-1.0.so.0 (0x00007f4482079000) libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x00007f4481e28000) libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00007f4481b1a000) libc.so.6 => /usr/lib/libc.so.6 (0x00007f4481777000) libxml2.so.2 => /usr/lib/libxml2.so.2 (0x00007f4481412000) libpangocairo-1.0.so.0 => /usr/lib/libpangocairo-1.0.so.0 (0x00007f4481205000) libgio-2.0.so.0 => /usr/lib/libgio-2.0.so.0 (0x00007f4480e8f000) libpangoft2-1.0.so.0 => /usr/lib/libpangoft2-1.0.so.0 (0x00007f4480c79000) libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007f4480a36000) libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007f4480770000) libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0x00007f448056c000) libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f448022a000) libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0x00007f4480024000) libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f447fe07000) libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00007f447fbfd000) libXinerama.so.1 => /usr/lib/libXinerama.so.1 (0x00007f447f9fa000) libXi.so.6 => /usr/lib/libXi.so.6 (0x00007f447f7e9000) libXrandr.so.2 => /usr/lib/libXrandr.so.2 (0x00007f447f5df000) libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0x00007f447f3d4000) libXcomposite.so.1 => /usr/lib/libXcomposite.so.1 (0x00007f447f1d1000) libXdamage.so.1 => /usr/lib/libXdamage.so.1 (0x00007f447efce000) libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f447edbc000) libpixman-1.so.0 => /usr/lib/libpixman-1.so.0 (0x00007f447eb0f000) libEGL.so.1 => /usr/lib/libEGL.so.1 (0x00007f447e80e000) libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f447e60a000) libpng16.so.16 => /usr/lib/libpng16.so.16 (0x00007f447e3d4000) libxcb-shm.so.0 => /usr/lib/libxcb-shm.so.0 (0x00007f447e1d0000) libxcb-render.so.0 => /usr/lib/libxcb-render.so.0 (0x00007f447dfc6000) libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f447dda4000) libz.so.1 => /usr/lib/libz.so.1 (0x00007f447db8e000) libGL.so.1 => /usr/lib/libGL.so.1 (0x00007f447d836000) librt.so.1 => /usr/lib/librt.so.1 (0x00007f447d62e000) libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x00007f447d42c000) libpcre.so.1 => /usr/lib/libpcre.so.1 (0x00007f447d1bd000) libffi.so.6 => /usr/lib/libffi.so.6 (0x00007f447cfb4000) /lib64/ld-linux-x86-64.so.2 (0x00007f4483859000) liblzma.so.5 => /usr/lib/liblzma.so.5 (0x00007f447cd8e000) libharfbuzz.so.0 => /usr/lib/libharfbuzz.so.0 (0x00007f447cb31000) libresolv.so.2 => /usr/lib/libresolv.so.2 (0x00007f447c91a000) libexpat.so.1 => /usr/lib/libexpat.so.1 (0x00007f447c6f0000) libbz2.so.1.0 => /usr/lib/libbz2.so.1.0 (0x00007f447c4e0000) libnvidia-glsi.so.346.47 => /usr/lib/libnvidia-glsi.so.346.47 (0x00007f447c256000) libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f447c052000) libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f447be4c000) libnvidia-tls.so.346.47 => /usr/lib/libnvidia-tls.so.346.47 (0x00007f447bc49000) libnvidia-glcore.so.346.47 => /usr/lib/libnvidia-glcore.so.346.47 (0x00007f4478f70000) libgraphite2.so.3 => /usr/lib/libgraphite2.so.3 (0x00007f4478d52000) ----- Krita: ldd `which krita` linux-vdso.so.1 (0x00007ffe5d19b000) libkritaui.so.14 => /usr/lib/libkritaui.so.14 (0x00007fa0af536000) libQtGui.so.4 => /usr/lib/libQtGui.so.4 (0x00007fa0ae847000) libkdecore.so.5 => /usr/lib/libkdecore.so.5 (0x00007fa0ae35d000) libQtCore.so.4 => /usr/lib/libQtCore.so.4 (0x00007fa0ade6e000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fa0adb5f000) libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fa0ad949000) libc.so.6 => /usr/lib/libc.so.6 (0x00007fa0ad5a6000) libX11.so.6 => /usr/lib/libX11.so.6 (0x00007fa0ad264000) libXi.so.6 => /usr/lib/libXi.so.6 (0x00007fa0ad053000) libkfile.so.4 => /usr/lib/libkfile.so.4 (0x00007fa0acda4000) libkritacolor.so.14 => /usr/lib/libkritacolor.so.14 (0x00007fa0acba0000) libkritalibbrush.so.14 => /usr/lib/libkritalibbrush.so.14 (0x00007fa0ac94e000) libkowidgets.so.14 => /usr/lib/libkowidgets.so.14 (0x00007fa0ac64d000) libpng16.so.16 => /usr/lib/libpng16.so.16 (0x00007fa0ac417000) libexiv2.so.13 => /usr/lib/libexiv2.so.13 (0x00007fa0abef1000) libGLU.so.1 => /usr/lib/libGLU.so.1 (0x00007fa0abc70000) libGL.so.1 => /usr/lib/libGL.so.1 (0x00007fa0ab918000) libQtOpenGL.so.4 => /usr/lib/libQtOpenGL.so.4 (0x00007fa0ab617000) libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fa0ab413000) libGLEW.so.1.12 => /usr/lib/libGLEW.so.1.12 (0x00007fa0ab17f000) libkritaimage.so.14 => /usr/lib/libkritaimage.so.14 (0x00007fa0aac9c000) libflake.so.14 => /usr/lib/libflake.so.14 (0x00007fa0aa8ff000) libkowidgetutils.so.14 => /usr/lib/libkowidgetutils.so.14 (0x00007fa0aa6e9000) libkoodf.so.14 => /usr/lib/libkoodf.so.14 (0x00007fa0aa431000) libkio.so.5 => /usr/lib/libkio.so.5 (0x00007fa0a9f5f000) libQtNetwork.so.4 => /usr/lib/libQtNetwork.so.4 (0x00007fa0a9c15000) libpigmentcms.so.14 => /usr/lib/libpigmentcms.so.14 (0x00007fa0a98b2000) libQtXml.so.4 => /usr/lib/libQtXml.so.4 (0x00007fa0a966c000) libkoplugin.so.14 => /usr/lib/libkoplugin.so.14 (0x00007fa0a9460000) libkundo2.so.14 => /usr/lib/libkundo2.so.14 (0x00007fa0a924c000) libkdeui.so.5 => /usr/lib/libkdeui.so.5 (0x00007fa0a8bb5000) libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fa0a8998000) libQtDBus.so.4 => /usr/lib/libQtDBus.so.4 (0x00007fa0a871b000) libm.so.6 => /usr/lib/libm.so.6 (0x00007fa0a8416000) libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00007fa0a8108000) libz.so.1 => /usr/lib/libz.so.1 (0x00007fa0a7ef2000) libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007fa0a7c2c000) libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x00007fa0a79db000) libSM.so.6 => /usr/lib/libSM.so.6 (0x00007fa0a77d3000) libICE.so.6 => /usr/lib/libICE.so.6 (0x00007fa0a75b6000) libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00007fa0a73ac000) libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007fa0a7169000) libXext.so.6 => /usr/lib/libXext.so.6 (0x00007fa0a6f57000) libbz2.so.1.0 => /usr/lib/libbz2.so.1.0 (0x00007fa0a6d47000) liblzma.so.5 => /usr/lib/liblzma.so.5 (0x00007fa0a6b21000) librt.so.1 => /usr/lib/librt.so.1 (0x00007fa0a6919000) /lib64/ld-linux-x86-64.so.2 (0x00007fa0aff50000) libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007fa0a66f7000) libsolid.so.4 => /usr/lib/libsolid.so.4 (0x00007fa0a63ef000) libkritacolord.so => /usr/lib/libkritacolord.so (0x00007fa0a61d5000) libQtSvg.so.4 => /usr/lib/libQtSvg.so.4 (0x00007fa0a5f7d000) libkotext.so.14 => /usr/lib/libkotext.so.14 (0x00007fa0a5c0b000) libexpat.so.1 => /usr/lib/libexpat.so.1 (0x00007fa0a59e1000) libnvidia-tls.so.346.47 => /usr/lib/libnvidia-tls.so.346.47 (0x00007fa0a57de000) libnvidia-glcore.so.346.47 => /usr/lib/libnvidia-glcore.so.346.47 (0x00007fa0a2b05000) libboost_system.so.1.57.0 => /usr/lib/libboost_system.so.1.57.0 (0x00007fa0a2901000) libHalf.so.11 => /usr/lib/libHalf.so.11 (0x00007fa0a26be000) libfftw3.so.3 => /usr/lib/libfftw3.so.3 (0x00007fa0a22bd000) libgsl.so.0 => /usr/lib/libgsl.so.0 (0x00007fa0a1e93000) libgslcblas.so.0 => /usr/lib/libgslcblas.so.0 (0x00007fa0a1c57000) libqca.so.2 => /usr/lib/libqca.so.2 (0x00007fa0a1944000) libstreamanalyzer.so.0 => /usr/lib/libstreamanalyzer.so.0 (0x00007fa0a16b6000) libacl.so.1 => /usr/lib/libacl.so.1 (0x00007fa0a14ad000) libattr.so.1 => /usr/lib/libattr.so.1 (0x00007fa0a12a8000) libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0x00007fa0a102d000) libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x00007fa0a0bb1000) libattica.so.0.4 => /usr/lib/libattica.so.0.4 (0x00007fa0a08bb000) libdbusmenu-qt.so.2 => /usr/lib/libdbusmenu-qt.so.2 (0x00007fa0a0683000) libXtst.so.6 => /usr/lib/libXtst.so.6 (0x00007fa0a047d000) libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0x00007fa0a0272000) libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0x00007fa0a006c000) libdbus-1.so.3 => /usr/lib/libdbus-1.so.3 (0x00007fa09fe23000) libpcre.so.1 => /usr/lib/libpcre.so.1 (0x00007fa09fbb4000) libharfbuzz.so.0 => /usr/lib/libharfbuzz.so.0 (0x00007fa09f957000) libffi.so.6 => /usr/lib/libffi.so.6 (0x00007fa09f74e000) libuuid.so.1 => /usr/lib/libuuid.so.1 (0x00007fa09f549000) libXau.so.6 => /usr/lib/libXau.so.6 (0x00007fa09f345000) libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007fa09f13f000) libudev.so.1 => /usr/lib/libudev.so.1 (0x00007fa0b0142000) libstreams.so.0 => /usr/lib/libstreams.so.0 (0x00007fa09eefe000) libxml2.so.2 => /usr/lib/libxml2.so.2 (0x00007fa09eb99000) libgraphite2.so.3 => /usr/lib/libgraphite2.so.3 (0x00007fa09e97b000) libcap.so.2 => /usr/lib/libcap.so.2 (0x00007fa09e777000)
Have you asked the fontconfig people about the configuration issue? I (and many others) use subpixel AA for screen rendering, and still GIMP's font rendering is OK. So I tend to trust the fontconfig guys' statement that this problem is related to a broken fonconfig setup. The problem also went away for some people when upgrading their system. How Krita or GPaint render their fonts is probably different and not relevant here.
It seems that this issue stems from when a desktop environment uses (or writes to) the global '~/.config/fontconfig/fonts.conf' (I think it used to be '~/.fonts.conf') file for antialiasing configuration. I know that at least KDE uses this to override global configuration files (which would be in '/etc/fonts/conf.d', I believe), and I believe there are other desktop environments that do as well - perhaps Xfce, though I don't know for sure. Deleting the local config file inside of .config fixes this bug, though probably would NOT be a valid solution for people who want to override their distribution's default options. However, it also seems that deleting just the relevant part of the config file works too; removing these lines works for me: <match target="font"> <edit mode="assign" name="rgba"> <const>rgb</const> </edit> </match> It's interesting to note that '/etc/fonts/conf.d' does not contain a file that specifies this anywhere, which I find weird. So, if anyone has an odd computer setup where fontconfig can't detect that they have an LCD monitor, they might not be able to ever get this bug in Gimp fixed without also removing all subpixel rendering from the rest of their applications. And of course, every time anyone edits KDE's font rendering settings, or potentially the font settings for other desktop environments besides Gnome, they'll have to go in and delete that part of the configuration file after doing so. I don't know if you guys will still consider this to not be a Gimp/Gnome bug, but it doesn't seem likely that it'll ever be resolved through any other route. People who have hardware that FontConfig won't detect as an LCD display will also be permanently out of luck, so it probably isn't a good idea to ask KDE to simply not add that part of the config file.
*** Bug 781474 has been marked as a duplicate of this bug. ***
Hey all! We have a bunch of people reporting similar issues and it comes from them having installed a package called "fontconfig-infinality". Simply uninstalling this package fixes the problem. I am unsure so I hesitate to just mark them as duplicates, but it looks like quite a similar problem. If anyone still reading here still has this problem, please check if you have installed such "infinality" package, get rid of it and try again. If it also fixes your problem, could you please report here as well to confirm? See bug 708052.
Jehan: Infinality is a patchset mainly for freetype, typically used together with some fontconfig configurations. It could be that with the patch and/or some fontconfig setting, sub-pixel is force enabled. But in that case, the user should address the force-enable (probably can be fixed by fixing fontconfig settings and/or env variables for gimp). Or maybe it's not force-enabled and it's GIMP's fault again, but currently GIMP (version 2.8.22) seems to render properly without sub-pixel although I have it enabled, so it's probably not GIMP. In either case, it's not as easy to uninstall this package for most people, as it's most likely deliberately installed to achieve certain font rendering features, and uninstalling this package will lead to making fonts look worse for said user.