2

Fira Sans fonts are displaying incorrectly in Firefox. When I use 'Fira Sans Extra Bold' in Google docs, it doesn't show extra bold, but only in Firefox. In Chrome, the font displays just fine.

It's almost like Firefox is limiting which Fira fonts display?

I'm using Ubuntu 22.04 by the way.

Why would Firefox not show Fira Sans?

For example:

enter image description here

Update

It seems if I change the firefox settings fonts section to list Fira Sans for everything, then it updates to Fira Sans, but in Google Docs, I can't choose Fira Sans ExtraBold or Fira Sans Black or any other styles. What gives? What's messed up in the wiring?

By the way, everything works fine in Chrome, so it seems it's Firefox on Ubuntu that's the issue.

If I change Firefox default font setting to a different font, Google Docs still thinks Fira Sans is whatever the other default I picked.

  • 1
    I suspect Google Docs uses embedded fonts from the Google fonts directory, and never your locally installed fonts. If they don't include those versions in what they embed, you're kind of out of luck. – frabjous Jun 10 '22 at 16:53
  • In Chrome the fonts display correctly. – Costa Michailidis Jan 27 '23 at 18:51

2 Answers2

2

First make sure that the Fira Sans font files are available in a proper place. You can for instance create this directory:

sudo mkdir -p /usr/local/share/fonts/firasans

and copy the files into it.

Next: Google docs is a web site, right? The fonts used by default when browsing the web is determined by fontconfig. So you need to tell fontconfig that you prefer Fira Sans fonts when using Firefox:

  • Create a directory for your Firefox fontconfig preferences:

    mkdir -p ~/snap/firefox/current/.config/fontconfig/conf.d
    
  • Create a file named 10-prefer-firasans.conf in that directory and give it this content:

    <fontconfig>
      <alias>
        <family>sans-serif</family>
        <prefer>
          <family>Fira Sans</family>
        </prefer>
      </alias>    
    </fontconfig>
    

Finally restart Firefox.

Gunnar Hjalmarsson
  • 33,540
  • 3
  • 64
  • 94
1

Since Ubuntu 22.04 some (not all) applications are shipped in "snap packages". These are "sand boxed", meaning they do have any access to your environment. I assume Google has the fonts packaged within , whereas Firefox hasn't. (Since they're google fonts)

My approach would be to remove snap (I described that here) and download the font. The fonts need to go to a special location:

sudo cp -r /home/username/Downloads/Fira_Sans /usr/share/fonts/truetype/

The combination of a snap free Firefox and the font you need installed, should solve the problem.

kanehekili
  • 6,402
  • Your answer suggests that all applications are shipped in snap packages, which definitely isn't true - but Firefox indeed is. Google Chrome, on the other side, is available from Google as a regular .deb package - this can make the difference. It would be interesting to try Chromium, which is distributed as snap as well. – raj Feb 08 '23 at 23:29
  • I'm sorry, but I downvoted your answer since you are wrong. There is no need to replace Firefox as snap in order to make use of a custom font. Please see my answer. – Gunnar Hjalmarsson Feb 08 '23 at 23:37
  • @raj: snap isn't the issue here. – Gunnar Hjalmarsson Feb 08 '23 at 23:51
  • I don't think I'm wrong, since I've done this - your answer may be more straightforward, ;-) – kanehekili Feb 09 '23 at 20:34
  • @kanehekili: A couple of years ago you would have been right.. But then they opened a door to the system fonts. The key is the file ~/snap/firefox/current/.config/fontconfig/fonts.conf – Gunnar Hjalmarsson Feb 10 '23 at 11:33
  • Yes, I understood your answer. Since one of my current distros does not offer snap by default, I resolved the problem the "old" way. So my "approach" was not the best one for the OP - since he uses snap - but it wasn't wrong as you mentioned above. – kanehekili Feb 10 '23 at 19:49