bohoomil / fontconfig-ultimate

freetype2-infinality run-time settings => infinality compatible fontconfig => infinality-bundle
453 stars 38 forks source link

rgba in base rendering settings corrupts GIMP text rendering? #63

Open ferdnyc opened 9 years ago

ferdnyc commented 9 years ago

I noticed that conf.d.infinality/10-base-rendering.conf (as of b2aa9ecc29f03b0cc2c5a1fc55831daa24a11504) contains the following global font configuration:

  <!-- ## Base rendering settings ## -->
  <match target="font">
    <edit name="rgba" mode="assign">
      <const>rgb</const>
    </edit>
...

The same setting, which used to be in 50-base-rendering-inf-osx-lin.conf in infinality's packages, is the cause of a longstanding issue (acknowledged/confirmed by infinality) with GIMP text layers, causing subpixel artifacts to appear on any non-black text.

Simply removing that <edit name="rgba"...> ... </edit> element has been shown to fix GIMP's text rendering, seemingly without affecting font rendering across the rest of the system. (If I'm understanding that configuration's purpose, subpixel will no longer be forced on globally for all text rendering, including in situations where it causes problems. It'll still be used when it should be.)

I can't say with absolute certainty that removing the config has zero effect, but I haven't noticed any rendering differences on my system — other than GIMP's no longer looking terrible.

Apologies for not submitting a patch, I'm still running Fedora 20 with infinality's rpms for the moment. Tracking this down is part of my prep for the Fedora 21 upgrade. But I know that with the current GIMP 2.8.14, having that config in 50-base-rendering-inf-osx-lin.conf still causes problems, and presumably the same would be true for 10-base-rendering.conf.

Is there any reason <edit name="rgba"...> needs to be set in the global configs?

bohoomil commented 9 years ago

Hello @ferdnyc,

The issue can be worked around without altering 10-base-rendering.conf: see this. The solution has been found reliable by Gimp users, so we can leave global subpixel rendering as is since it works just fine with most applications.

BTW, as a Fedora user, would you mind participating in tailoring fontconfig-infinality for this distro? Basically, I'd appreciate opinions regarding fonts being commonly used on Fedora, the layout of Fedora-specific presets, etc. I've been working on the basic config set for some time now, but as a non-Fedora user, I don't want to force unnecessary or unwanted customizations.

ferdnyc commented 9 years ago

Hmmmm.

The issue can be worked around without altering 10-base-rendering.conf: see this. The solution has been found reliable by Gimp users, so we can leave global subpixel rendering as is since it works just fine with most applications.

I hadn't seen that, thanks for the link. But I guess that sort of illustrates my concern. (I don't mean to harp on this, and if you're adamant then I won't press the issue further. But I wanted to at least make the case for removing that stanza.)

Sure, it can be fixed without altering 10-base-rendering.conf, but is that the right solution? (It's the only one available to users who don't have rights to modify /etc/fonts/, of course, so it's still useful.) But the fix presented there seems less clean to me. It's effectively adding configs in GIMP to un-break what the configs in 10-base-rendering.conf previously broke, instead of fixing them so nothing gets broken in the first place.

Also, that fix requires each GIMP user (or GIMP packager) to discover and apply it, it's not something that could be distributed as part of fontconfig-ultimate. (Well, not cleanly anyway.) Which means that installing fontconfig-ultimate has the side-effect of breaking text rendering in GIMP (and perhaps elsewhere?), unless an external fix is applied. It seems preferable to me if installing fontconfig-ultimate just didn't break GIMP rendering.

And it seems like it doesn't have to. Here's a screenshot from my system, showing parts of Gnome-Terminal, Nautilus, and Firefox windows, with a detail from each magnified to 400%. infinality-subpixelwithoutconfig

Clearly, subpixel is still very much in use in all three applications, without that <edit name="rgba"...> stanza present in the /etc/fonts/ configs. And GIMP's rendering is now correct, with no special configuration. As far as I can tell, that stanza has no other purpose except to break rendering in GIMP! Removing it seems to have no impact other than not breaking GIMP, or requiring workarounds to un-break it.

Anyway... that's my take on the issue, as I said I won't press it further. Regarding your Fedora question, I'd be happy to help out where and how I can! Thanks.

bohoomil commented 9 years ago

As you aren't using prebuilt packages, you can simply introduce any changes you find necessary yourself: just fork the project and merge new commits in the future. It seems by far the easiest way to adopt the sources to your needs, at least for the time being.

(... and a brief excuse and explanation:)

Before I introduce any changes to the global configuration, I'll have to test it first: in the Arch community, there are plenty of users who don't install any desktop environment, just a simple (sometimes dead simple) WM with no support for extra utilities which let you tweak the look of your fonts. Hence the current defaults reflect the "Arch experience", also in our approach to customization. This is a bit unfortunate, which I'm aware of, because in a way it seems like I were forcing a single solution upon other distros. It's not exactly what I wanted, though (that's why I've been asking for assistance in creating distro-specific fontconfig-infinalitys). All the Infinality stuff is a DIY kit in the first place: what works in one context, may not be the best solution in another. However, I can't maintain all sorts of distro-specific configuration templates myself because I'm only using a single one on a regular basis. (I do have Fedora and Ubuntu available on virtual machines, but it doesn't make me a regular Fedora or Ubuntu user.) My fontconfig-iu fork was born because the original fontconfig-infinality by Infinality was pretty unreliable in the Arch realm. I can imagine that my one might not be 100% compatible with the needs of non-Archers just the same.

I believe the best approach for me would be to cooperate with fontconfig-infinality maintainers for other Linux flavors. Otherwise, there will always be problematic options that for some users just won't work as expected. Unfortunately, there's not a single Linux, but Linuces instead. Many packages are built a bit differently on various systems, which is a common practice in the Linux world. IMO, it would be best for fontconfig-infinality to maintain different branches locally instead of craving for the most universal configuration for all because it's hardly possible to create such. Feel welcome if you want to participate. ;-)

JotaRandom commented 9 years ago

why not add the sniplet for gimp (the one that requieres simplu add a fonts.conf file to the main gim p config file in a separate package for those like my who not want copy the .conf file over and over and over and over again maybe a small package iu-gimp-workaround so users could deside if they want try the script or not and try other things.