install fonts manual in
/usr/local/share/fonts
then create /etc/fonts/conf.avail/65-ubuntu-font-family-arabic.conf
contains
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="pattern">
<test name="family" compare="eq">
<string>Ubuntu</string>
</test>
<test name="lang" compare="contains">
<string>ar</string>
</test>
<edit name="family" mode="assign" binding="strong">
<string>Ubuntu Arabic</string>
</edit>
</match>
<match target="pattern">
<test name="family" compare="eq">
<string>DejaVu</string>
</test>
<test name="lang" compare="contains">
<string>ar</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>Ubuntu Arabic</string>
</edit>
</match>
<match target="pattern">
<test name="family" compare="eq">
<string>DejaVu Sans</string>
</test>
<test name="lang" compare="contains">
<string>ar</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>Ubuntu Arabic</string>
</edit>
</match>
<match target="pattern">
<test name="family" compare="eq">
<string>DejaVu Serif</string>
</test>
<test name="lang" compare="contains">
<string>ar</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>Ubuntu Arabic</string>
</edit>
</match>
<match target="pattern">
<test name="family" compare="eq">
<string>DejaVu Serif</string>
</test>
<test name="lang" compare="contains">
<string>ar</string>
</test>
<edit name="family" mode="assign" binding="strong">
<string>Ubuntu Arabic</string>
</edit>
</match>
<alias>
<family>DejaVu Serif</family>
<prefer>
<family>Ubuntu Arabic</family>
<family>DejaVu Serif</family>
</prefer>
</alias>
<alias>
<family>DejaVu Sans</family>
<prefer>
<family>Ubuntu Arabic</family>
<family>DejaVu Sans</family>
</prefer>
</alias>
<alias>
<family>DejaVu</family>
<prefer>
<family>Ubuntu Arabic</family>
<family>DejaVu</family>
</prefer>
</alias>
</fontconfig>
and create syslink for it in /etc/fonts/conf.d/
ogra
April 20, 2020, 5:29pm
10
have you tried putting the font into
~/.local/share/fonts/
might be that snapd’s desktop interface simply does not allow access to /usr/local/share/fonts …
ppd
April 20, 2020, 6:06pm
11
ogra
April 20, 2020, 6:19pm
12
ah i had only checked the snapd source, not the apparmor font abstraction …
# other interfaces (eg, wayland). #include <abstractions/dbus-strict> #include <abstractions/dbus-session-strict> # Allow finding the DBus session bus id (eg, via dbus_bus_get_id()) dbus (send) bus=session path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=GetId peer=(name=org.freedesktop.DBus, label=unconfined), #include <abstractions/fonts> owner @{HOME}/.local/share/fonts/{,**} r, /var/cache/fontconfig/ r, /var/cache/fontconfig/** mr, # some applications are known to mmap fonts /usr/{,local/}share/fonts/** m, # subset of gnome abstraction
the issue not read fonts
chromium can found “Ubuntu Arabic” but cannot read conf.d that make it replace to "DejaVu "
oSoMoN
April 22, 2020, 1:18pm
15
Can you try the following? Edit ~/snap/chromium/current/.config/fontconfig/fonts.conf
to add the following line:
<include ignore_missing="yes">/etc/fonts/conf.d</include>
Then save the file and restart chromium.
I’m not really sure what to expect visually, but I can tell that when stracing the snap, adding that line allowed the app to find and read your custom fonts configuration file.
2 Likes
Thank you, that work great!
how i can do it globally?
oSoMoN
April 22, 2020, 2:27pm
17
@jamesh is this something we should consider for addition to the desktop helpers?
1 Like
after restart the changes removed
oSoMoN
April 24, 2020, 12:12pm
20
Ah, that’s quite unfortunate… Indeed the fontconfig file is regenerated everytime there’s an update (a new revision) to the snap. We need a way for users to define custom configs that stick.
Create an empty fontconfig-user.conf
if it doesn’t exist for <include>
? Only touch that file if it doesn’t exist, so that the fontconfig ruleset doesn’t break by it potentially not being present, allowing the user to add their custom rules in this separate non-generated file.
1 Like
I’m seeing the same, in two snaps (Firefox, and mattermost-desktop). Haven’t noticed others just yet.
The fix, again, a matter of editing fonts.conf:
~$ diff ~/snap/mattermost-desktop/current/.config/fontconfig/fonts.conf.busted ~/snap/mattermost-desktop/current/.config/fontconfig/fonts.conf
6c6
< <include ignore_missing="yes">conf.d</include>
---
> <include ignore_missing="yes">/etc/fonts/conf.d</include>
So, given that this is across multiple snaps, and the workaround doesn’t stick anyway, we need to figure a way to avoid this affecting users on an ongoing basis. Is there a bug already reported against $something to track that?
ec0
June 25, 2020, 3:13am
23
I suspect this is likely a bug in the desktop interface if it requires a manual workaround like this.
For reference: https://github.com/snapcore/snapd/blob/master/interfaces/builtin/desktop.go#L56
It sounds more like it is a bug in the desktop-helpers or in snapd’s font caching that happens during a refresh than it is with the interface itself.
What writes the file $SNAP_USER_DATA/.config/fontconfig/fonts.conf
? It seems like since it is in $SNAP_USER_DATA that it would be something the desktop-helpers would be writing.
1 Like
this issue should be fixed years before
Maybe you know how to fix it but the solution provided by @oSoMoN fix the problem for short time and his solution want me to modify files that removed after any new update for the Snap package
@oSoMoN I created PR to Snapcraft Desktop Heloper
Should it fix the issue?
Is there need to rebuild snaps to make changes affect?
The PR: https://github.com/ubuntu/snapcraft-desktop-helpers/pull/213
SYaslem
September 3, 2020, 10:03pm
27
After running this several times I’ve cheated a little:
for i in ls /etc/fonts/conf.d/*.conf ; do ln -s $i ~/.local/share/fonts/ ; done