Open Bug 1760996 Opened 1 year ago Updated 6 days ago

Firefox snap cannot access user fonts and fontconfig files, so @font-face { ... src: local(Some Font Name)} doesn't work


(Firefox Build System :: Third Party Packaging, defect, P2)



(Not tracked)


(Reporter: emil, Unassigned)


(Blocks 1 open bug)


User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:98.0) Gecko/20100101 Firefox/98.0

Steps to reproduce:

The latest Firefox snap in Ubuntu Jammy (1:1snap1-0ubuntu1) is unable to access fonts and font configuration files in the users directory, namely:


This breaks user-specific fonts in my case using Syriac fonts and fontconfig specific configuration files.

Olivier FYI

Blocks: snap
Flags: needinfo?(olivier)

The firefox snap's apparmor profile (/var/lib/snapd/apparmor/profiles/snap.firefox.firefox) has the following lines:

#include <abstractions/fonts>
owner @{HOME}/.local/share/fonts/{,**} r,
/var/cache/fontconfig/   r,
/var/cache/fontconfig/** mr,

and /etc/apparmor.d/abstractions/fonts contains, among other rules:

owner @{HOME}/.fonts.conf             r,
owner @{HOME}/.fonts/                 r,
owner @{HOME}/.fonts/**               r,
owner @{HOME}/.local/share/fonts/     r,
owner @{HOME}/.local/share/fonts/**   r,
owner @{HOME}/.fonts.cache-2          mr,
owner @{HOME}/.{,cache/}fontconfig/   rw,
owner @{HOME}/.{,cache/}fontconfig/** mrl,
owner @{HOME}/.fonts.conf.d/          r,
owner @{HOME}/.fonts.conf.d/**        r,
owner @{HOME}/.config/fontconfig/     r,
owner @{HOME}/.config/fontconfig/**   r,

So the permissions are there.

Now, the snap's view of the $HOME directory is ~/snap/firefox/common, and the value of $XDG_DATA_HOME is ~/snap/firefox/current/.local/share. So the question is, were your local fonts copied to either ~/snap/firefox/common/.fonts/ or ~/snap/firefox/current/.local/share/fonts ?

Flags: needinfo?(olivier)

I did not copy either the fonts or the fontconfig configuration files to the directories under ~/snap/firefox/common/. Given where the fonts are currently stored in my home directory, it makes the most sense for me to create a symlink to where they currently reside.

Copying either the fonts or font configurations or symlinking them it not intuitive. Would it be possible to symlink during snap installation so that it doesn't break for users or provide a mechanism outside of the snap to look for these files?

As mentionned in comment 4, it's an upstream issue. To date, no move on those.

Component: Release Automation: Snap → Third Party Packaging
Product: Release Engineering → Firefox Build System
Version: --- → unspecified

The severity field is not set for this bug.
:gerard-majax, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(lissyx+mozillians)
Flags: needinfo?(lissyx+mozillians)
See Also: → 1767925

I hope my experience can help…
I manage a website with Materialize Icons font. Until yesterday I was using the Firefox package on Ubuntu 20.04 with no problem (as on other browsers and platforms). Yesterday, I have upgraded to Ubuntu 22.04 and the icons were not showing anymore on Firefox snap. No problem with Chromium.
Inspired by , the css file is:

/* fallback /
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(../../fonts/material-icons.eot); /
For IE6-8 */
src: local('Material Icons'),
url(../../fonts/material-icons.woff2) format('woff2'),
url(../../fonts/material-icons.woff) format('woff'),
url(../../fonts/material-icons.ttf) format('truetype');

.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;

/* Support for all WebKit browsers. */
-webkit-font-feature-settings: 'liga';
-webkit-font-smoothing: antialiased;

/* Support for Safari and Chrome. */
text-rendering: optimizeLegibility;

/* Support for Firefox. */
-moz-font-feature-settings: 'liga';
-moz-osx-font-smoothing: grayscale;

/* Support for IE. */
font-feature-settings: 'liga';

If I remove the two "local()" instructions, the icons are shown on Firefox snap.

Severity: -- → S3
Priority: -- → P3
Duplicate of this bug: 1800341

(Marking as "new" i.e. confirmed; I can repro this using the STR in bug 1800341 comment 17.)

Ever confirmed: true
Summary: Firefox snap cannot access user fonts and fontconfig files → Firefox snap cannot access user fonts and fontconfig files, so @font-face { ... src: local(Some Font Name)} doesn't work
Priority: P3 → P2

I have set up a workaround which uses symlinks:

  • ~/snap/firefox/current/.local/share/fonts~/.local/share/fonts
  • ~/snap/firefox/current/.config/fontconfig~/.config/fontconfig
You need to log in before you can comment on or make changes to this bug.