36

Recently, on my Ubuntu 18.04 I have noticed that at least on gnome-calculator and chromium browser the fonts are displayed as squares. I have followed instructions here and here, the calculator is fixed, but the problem on chromium still exists when I open a dialog to search for a file.

Not sure if this happens on other applications as well, I haven't checked all my apps, but File managers nemo and nautilus are working fine.

Also, before few months ago, I have included some windows fonts for my libre office shown here. I used the copy (cp) method, not the link (ln -s). But, was working fine until yesterday. Haven't done any major change or update, at least on my Linux partition (dual boot). But, I don't think that this has anything to do with that.

Any idea how can I fix this issue?

browse dialog.

ioaniatr
  • 1,301
  • 1
  • 11
  • 13
  • 2
  • With this answer the calculator is fixed, but not chromium. Not sure if is only chromium or general issue. I haven't found any other app so far except those two. Also, I don't know what caused this. – ioaniatr Apr 05 '20 at 17:08
  • Following https://askubuntu.com/questions/841706/all-fonts-on-xubuntu-are-now-boxes-everything-is-illegible-help I tried rm -rf ~/.cache/fontconfig; sudo fc-cache -r -v; chromium and it worked. Chromium gave the message [9572:1:0406/185207.504191:ERROR:child_process_sandbox_support_impl_linux.cc(79)] FontService unique font name matching request did not receive a response on startup. But then the next time I started it, it was broken again :( – unhammer Apr 06 '20 at 17:02
  • I just installed the regular version of chromium-browser shown here: https://askubuntu.com/questions/1075103/chromium-config-folder-is-missing-in-ubuntu-18-04. Regular version is working fine, but not the snap version. Firefox, Opera, Chrome are working fine as well. Does this has to do because was the snap version that I had installed? Can I fix the snap version? – ioaniatr Apr 06 '20 at 19:25

6 Answers6

55

I found the solution, was more simple than I thought.

First, you need to update local cache as described here:

rm -rf ~/.cache/fontconfig 
sudo fc-cache -r -v

Then, you need to find fontconfig folder inside snap, since this is the snap version of chromium.

find ~/snap/chromium/ -name 'fontconfig'

Last, remove this folder inside .cache:

rm -rf ~/snap/chromium/common/.cache/fontconfig/

Afterwards, chromium will recreate this folder automatically by using your local updated fontconfig inside ~/.cache/fontconfig.

Restart chromium browser to take this effect.

vanadium
  • 88,010
ioaniatr
  • 1,301
  • 1
  • 11
  • 13
1

(The previous answer is the better but just a note for future readers)

Another way the problem described above happens is when ~/.config/gtk-3.0/settings.ini becomes corrupted. Make sure to delete any gtk-font-name and/or other incomplete lines from that file. Apparently, if GTK fails to parse it, you get the same problem as the screenshot shown above.

1

Deleting the fontconfig file inside the postman directory worked for me for Ubuntu 22.04:

rm -rf ./snap/postman/common/.cache/fontconfig
1

I still had the problem on 23.04 with Mate with Ferdium app. I deleted all 3 folders but still have squares instead of letters.

What worked for me was removing the snap package and installing the .deb archive.

0

To anyone still experiencing this issue after clearing and rebuilding the font cache, it's worth noting that incorrect permissions could also be a possible cause. Additionally - depending on your application and the content you're opening / reading - it could simply be a case of not having the correct font family / font pack installed for the source content.

To ensure your permissions are correct (related answer):

find /usr/share/fonts -iname '*.ttf' -type f -exec sudo chmod -v 644
find /usr/share/fonts -iname '*.otf' -type f -exec sudo chmod -v 644

Followed by cache refresh -

sudo fc-cache -r -v

As for font packs, it's usually a good idea to install distribution "recommended fonts" packages (most have such packs included in their package managers, and some come preinstalled, so google and distribution-specific docs will be your friend here.

These meta-packages include the most common fonts, and should take care of most compatibility requirements for everyday use. Check your package manager first, a cross-package (like recommended-fonts-ubuntu, or similar, may exist already).

Some examples:

I ran into this issue in ArchLinux, trying to keep my installation as lean as possible. I quickly learnt that, at least when it comes to fonts, installing a few packs with the more common fonts saves a lot of headache down the line - even if it means there a few redundant characters lying about your system :)

A combination of all of the above is what finally solved my problem.

0

I ran into this problem with some Snap Applications under Ubuntu 23.10, specifically MS Teams and Draw.io.

I ended up removing the following line from all files within ~/snap/*/current/.config/fontconfig/fonts.conf (e.g. ~/snap/drawio/current/.config/fontconfig/fonts.conf:

  <cachedir>/home/$(id -un)/.cache/fontconfig</cachedir>

Where $(id -un) needs to be substituted with your actual account name.

So if your name is some-ubunut-user you'd have to remove that line:

<cachedir>/home/some-ubunut-user/.cache/fontconfig</cachedir>

The reasoning here is, that Snap Applications get their own filesystem mountedcd sn and some folders are not readable for all applications, e.g. Draw.io may not access ~/.cache (as well as ~/.local). So it is possible that Applications try to use Fonts, that are not accessible for them. See e.g. Where can Ubuntu snaps write data?