Ubuntu 20.04 interface font too small after restart, even with high scaling factor

So I was configuring VS code on my Notebook when suddenly I noticed that my interface font got really small on my desktop, terminal and files.

I use Gnome Tweaks Tool to increase my scaling factor to 1,15 , but, even though it was active, the font stayed tiny.

The solution I found was moving my scaling factor, which instantly fixed my font issue, however, every time I restart my Notebook the font gets tiny again and I have to repeat the process.

I tried reseting my font configuration using this command, but had no success.

gsettings reset org.gnome.desktop.interface text-scaling-factor

I also tried using the command

dconf reset -f /

Finally, I tried using dconf-editor, but still had no success altering the font rendering DPI or changing the scaling factor.

All of the steps I mentioned fixed my fonts temporarily, but the issue still persists when I restart my Notebook

I am out of ideas and even considered getting a fresh Ubuntu install by now...

My video card: NVIDIA GeForce GTX 1050 GPU


Update 2020-10-07

The bug is now fixed, you can get it with apt and remove any workaround you had chosen.

Original answer

It's a recently introduced bug in Mutter which is the default window manager for Gnome Shell.
https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/1892440

It seems to affect mainly Nvidia cards.

It was fixed in Pop!_OS by removing the patch named "x11-Add-support-for-fractional-scaling-using-Randr.patch"
https://github.com/pop-os/pop/issues/1170 https://github.com/pop-os/mutter/commit/a912c7fc25f4797047790fc5df1711eeb31af282

Ubuntu devs did not say how they will resolve this but at least they acknowledged the problem and someone is assigned to it.

The only known workaround for now is what you described: in Gnome Tweaks, change the scaling factor to something else and back to the original value. Unfortunately, as you noted this will be needed after each login and even after each restart of Gnome Shell (ALT+F2, r).


EDIT 2020/10/07

The bug has been fixed in the package mutter (3.36.6-1ubuntu0.20.04.2), available via apt.

Original answer

Inspired by this answer I implemented a temporary workaround in my machine. I'm currently using Ubuntu 20.04.1 with GNOME Shell 3.36.4.

This does NOT fix the font size in GDM login screen, but only after the login. This trick simply avoids to repeat an annoying sequence of commands after every reboot. Of course this trick may be useful only till the bug in Mutter is fixed.

  1. Create a script (I put it in ~/.local/bin) with the following content:

    sleep 5s
    gsettings set org.gnome.desktop.interface text-scaling-factor 1.01
    sleep 0.5s
    gsettings set org.gnome.desktop.interface text-scaling-factor 1.00
    

    '1.01' it's just a number to trigger the changes, it may be any value. I decided to use a value very near to the final one. '1.00' is the value that I eventually want. Feel free to put your target value. Same thing for the sleep times, you can change them.

  2. Make it executable running:

    chmod +x ~/.local/bin/fix-font-size.sh
    
  3. Run the script (I named it fix-font-size.sh) at boot. For this reason I run Startup Applications Preferences app and created a new item with the following command:

    bash -c "/home/username/.local/bin/fix-font-size.sh"
    

    Also see the screenshot for reference (where "Modifica programma d'avvio" means "Startup Applications Preferences"):

    add command to startup applications

  4. Save and you should have a correct size font after login without manually inserting commands in the terminal or by GUI.