Gnome Font Antialiasing?

I had changed the default Gnome font to Roboto on one of my systems that I am maintaining in my flake for someone else and it had worked for quite some time perfectly. Today, after updating my flake, I saw that the font had jagged edges. I use gnome-tweaks in order to change the fonts. I had the following setup (image taken from my laptop, but was the same on their desktop):

I reset gnome-tweaks to default and had the same problem. Changed fonts, logged out, restarted, rolled back, played with hinting and antialiasing, and continued to try cycling through different options many times to no avail.

Doing a little more research, I think it may have something to do with a file in /etc/fonts/fonts.conf per:
https://help.gnome.org/admin//system-admin-guide/2.32/fontconfig-4.html.en

Anyway, before I start blasting files away :nix_parrot:, is there a way to reset the font configs or antialiasing in a proper nix manner?

Thanks!

The default values are slight hinting and grayscale antialiasing, see the GSettings schema. You can reset it with:

gsettings reset org.gnome.desktop.interface font-hinting 
gsettings reset org.gnome.desktop.interface font-antialiasing

These settings should affect GNOME Shell and GTK apps. Maybe some other things as well.

There are also hinting options in the NixOS fontconfig module, which I am not sure how it interact with apps. But that is managed declaratively so it should not change under your nose.

Maybe also check ~/.config/fontconfig and other paths mentioned in Files section of fonts.conf(5) in case something added its own config to your profile.

https://github.com/NixOS/nixpkgs/pull/194594

Thanks for the suggestion @jtojnar, but the resetting commands for gsetting did not work in this case. i also tried some other gsettings commands, but they did not fix the issue. I think @zendo below is correct in this being a hidpi issue. In any other case I bet this would have been the solution.

I attempted to add hardware.video.hidpi.enable = false; to my flake, but no results. I also tried setting up a module based on a link within your link from @Mic92 at Revert "Merge pull request #194594 from nbraud/hidpi" · Mic92/nixpkgs@9470bbb · GitHub.

No success with either. Is this something I can temporarily fix, or is it the much larger issue affecting many unstable Gnome users per your link? And in that case do I just wait for the experts to solve it? Trying to understand as this appears to be bigger than my skill levels with Nix. :slight_smile:

Thanks for the info!

I’m also using gnome unstable and my font is super blurry after the recent hidpi pr. However after setting hardware.video.hidpi.enable = false; my font did go back to normal again. Maybe you forget to restart or logout to take effect I think, at least that’s what I did until things go back normal again. I’m also not very happy about the way NixOS dealing with backward compatibility and breaking changes such case. Such breaking change which has profound effect for wide user base should be think carefully before getting merged.

I will try your suggestion again. I did log out, but I’ve noticed I’ve had to do so twice in certain instance for whatever reason. Or maybe a full reboot is needed, I’m not fully sure. Thanks for the advice! Will post back results after I have a chance to rebuild.

I agree, it seems this issue has affected quite a few users. Moving fast is great… until something breaks. :smile:

I ended up adding this line in the system’s flake config:

  fonts.optimizeForVeryHighDPI = true;

and the system has corrected the font anti-aliasing issue.

Hopefully if anyone else runs into this issue this post will be of use.

The option definition fonts.optimizeForVeryHighDPI' in /nix/store/…-source/nix/configuration.nix’ no longer has any effect; please remove it.

On unstable it no longer does anything. I solved the fonts problem with config below but I still think it doesn’t look exactly the same as before but I no longer have the older generations so I just might be imagining it.

  services.xserver.dpi = 180;
  fonts = {
    enableDefaultFonts = true;
    fontconfig = {
      antialias = true;
      hinting.enable = true;
      hinting.autohint = true;
    };
...

Hmmm. Maybe my system was corrected without my intervention then?

Update: this is no longer needed to function correctly.