openSUSE / openSUSEway

dotfiles for Sway on openSUSE
MIT License
82 stars 17 forks source link

font conflict on Tumbleweed >= 20230301 shows Chinese characters instead of Fontawesome #105

Closed FilippoBonazziSUSE closed 1 year ago

FilippoBonazziSUSE commented 1 year ago

After updating my Tumbleweed to snapshot 20230301 yesterday evening, I was greeted this morning by this sight: 20230303_08h40m57s_grim After some investigation, it turns out that the latest snapshot updated these packages related to fonts:

patterns-fonts-fonts-20170319-9.1.x86_64 (update)
patterns-fonts-fonts_opt-20170319-9.1.x86_64 (update)
babelstone-han-fonts-15.0.5-1.1.noarch (new package)

One of these, maybe the babelstone-han-fonts font, seems to be taking precedence over the Fontawesome 6 font installed with openSUSEway.

Fixing it in the displayed Waybar is easy enough (see https://github.com/Alexays/Waybar/issues/115):

--- waybar-branding-openSUSE-0.15.1-1.1.noarch/etc/xdg/waybar/style.css 2023-03-03 10:39:08.792397785 +0100
+++ /etc/xdg/waybar/style.css   2023-03-03 10:34:50.705692675 +0100
@@ -1,7 +1,7 @@
 * {
     border:        none;
     border-radius: 0;
-    font-family:   "Source Sans Pro";
+    font-family:   "Source Sans Pro", "Font Awesome 6 Free";
     font-size:     15px;
     box-shadow:    none;
     text-shadow:   none;

However this is a broader system issue, since it shows up also when looking at the waybar configuration file directly e.g. in (neo)vim: 20230303_10h56m23s_grim This is of course not good since you can't see what you're configuring.

I'm not sure what the best course of action would be. Having a Chinese font show up by default is obviously going to be a preferred choice for many people. However in practice it breaks our usage of Font Awesome in openSUSEway.

FilippoBonazziSUSE commented 1 year ago

I can confirm the Chinese font shown above is BabelStone Han. Found out by https://repolinux.wordpress.com/2013/03/10/find-out-fallback-font-used-by-fontconfig-for-a-certain-character/

taschenlampe commented 1 year ago
-    font-family:   "Source Sans Pro";
+    font-family:   "Source Sans Pro", "Font Awesome 6 Free";

Should this solve the "Chinese" situation, I still have Ch. fonts.

FilippoBonazziSUSE commented 1 year ago
-    font-family:   "Source Sans Pro";
+    font-family:   "Source Sans Pro", "Font Awesome 6 Free";

Should this solve the "Chinese" situation, I still have Ch. fonts.

The above "solves" the fonts displayed by Waybar, in the sense that Font Awesome is explicitly given precedence. I would still consider this a workaround more than a solution.

There is probably something specific to do to make it apply on a running system, but I haven't found it. The workaround worked fine for me after a reboot.

FilippoBonazziSUSE commented 1 year ago

@denisok opinions on how to fix this in a better way?

denisok commented 1 year ago

I don\t see a better way, but by no means I am specialist in font's systems.

Idea of Font Awesome are icons and I think giving it precedence is a good thing. I suppose that for the characters that couldn't be displayed it would search in other fonts and display it correctly for the Titles and etc.

I vote to fix it as proposed and wait for complains from ppl to see if we need to fix it again.

FilippoBonazziSUSE commented 1 year ago

I vote to fix it as proposed and wait for complains from ppl to see if we need to fix it again.

To fix it system-wide and wait for people to complain that they would rather have Chinese characters displayed? Or to fix it in the displayed Waybar only?

I would say the first one, as probably the subset of openSUSEway users which want to use this specific chinese font by default, overriding FontAwesome, is probably very small.

denisok commented 1 year ago

first one - waybar.

FilippoBonazziSUSE commented 1 year ago

I'm sorry I still have no idea what solution you want to implement.

FilippoBonazziSUSE commented 1 year ago

If anyone else is interested, I fixed it locally for my user by blacklisting the Babelstone Han font in ~/.config/fontconfig/fonts.conf:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>

<selectfont>
    <rejectfont>
        <pattern>
            <patelt name="family" >
                <string>Babelstone Han</string>
            </patelt>
        </pattern>
    </rejectfont>
</selectfont>

</fontconfig>
jubalh commented 1 year ago

I'm sorry I still have no idea what solution you want to implement.

As I understood, he prefers if you choose the solution that prefers the font awesome. I also support this solution.

FilippoBonazziSUSE commented 1 year ago

So applying the diff above to the waybar configuration file.

FilippoBonazziSUSE commented 1 year ago

Fixed in #118

a-kpappas commented 1 year ago

Before I saw this I filed it as https://bugzilla.opensuse.org/show_bug.cgi?id=1212415 and made a SR that adds the fontawesome-fonts as a requirement. https://build.opensuse.org/request/show/1093494