You are not logged in.

#1 2022-02-18 10:59:07

Jack_CM
Member
Registered: 2012-02-10
Posts: 55

[Solved] Monospace font problem

Hello,

lately I am having a weird font problem, like I am missing some font. Although I am not sure which one. This problem especially shows up in web browsers, see the pic
I found font is system-widely used as mono with:

$ fc-match monospace
Font Awesome 6 Brands-Regular-400.otf: "Font Awesome 6 Brands" "Regular"

Since I am using i3wm, I am not sure how to change it up. I think I need to work on $HOME/.config/fontconfig by adding the following

<match target="pattern">
  <test qual="any" name="family"><string>monospace</string></test>
  <edit name="family" mode="assign" binding="same"><string>Noto Sans Mono</string></edit>
</match>

The entire file looks like

<match target="font">
  <edit mode="assign" name="autohint"><bool>true</bool></edit>
  <edit mode="assign" name="hinting"><bool>true</bool></edit>
  <edit mode="assign" name="hintstyle"><const>hintslight</const></edit>
<match target="pattern">
  <test qual="any" name="family"><string>monospace</string></test>
  <edit name="family" mode="assign" binding="same"><string>Noto Sans Mono</string></edit>
</match>

</match>

But it is not really working, font-config complains about "junk after document element"

I am using i3wm, not sure what other info are needed

Last edited by Jack_CM (2022-02-18 14:36:31)

Offline

#2 2022-02-18 11:09:29

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,999
Website

Re: [Solved] Monospace font problem

Try

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
   <alias>
      <family>monospace</family>
      <prefer><family>Noto Sans Mono</family></prefer>
   </alias>
</fontconfig>

Place your hinting rules between the <fontconfig> & </fontconfig> lines (but not within the <alias></alias> bit).


Jin, Jîyan, Azadî

Offline

#3 2022-02-18 11:21:15

Jack_CM
Member
Registered: 2012-02-10
Posts: 55

Re: [Solved] Monospace font problem

Hello,
so if I  understand correctly I should produce a config file like this

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
   <edit mode="assign" name="autohint"><bool>true</bool></edit>
   <edit mode="assign" name="hinting"><bool>true</bool></edit>
   <edit mode="assign" name="hintstyle"><const>hintslight</const></edit>
   <alias>
      <family>monospace</family>
      <prefer><family>Noto Sans Mono</family></prefer>
   </alias>
</fontconfig>

I tried it, rerun fc-cache -vf but nothing changed, still seeing the awesome font as default. (BTW I made sure I have Noto Sans Mono installed)
I am really confused about the font configuration and it is also difficult to consult the wiki with this problem

Last edited by Jack_CM (2022-02-18 11:21:30)

Offline

#4 2022-02-18 11:25:18

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,999
Website

Re: [Solved] Monospace font problem

You missed the <match target=font> & </match> lines:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
   <match target="font">
      <edit mode="assign" name="autohint"><bool>true</bool></edit>
      <edit mode="assign" name="hinting"><bool>true</bool></edit>
      <edit mode="assign" name="hintstyle"><const>hintslight</const></edit>
   </match>
   <alias>
      <family>monospace</family>
      <prefer><family>Noto Sans Mono</family></prefer>
   </alias>
</fontconfig>

And yes, font configuration is confusing big_smile

EDIT: formatting.

Last edited by Head_on_a_Stick (2022-02-18 11:26:08)


Jin, Jîyan, Azadî

Offline

#5 2022-02-18 12:05:14

Jack_CM
Member
Registered: 2012-02-10
Posts: 55

Re: [Solved] Monospace font problem

Hi, still having the same results with fc-match monospace, and I am more confused than ever

Offline

#6 2022-02-18 13:03:36

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,999
Website

Re: [Solved] Monospace font problem

How did you install that "Font Awesome 6 Brands"?

If I install both ttf- & otf-font-awesome from [Community] along with noto-fonts from [Extra] then Noto Sans Mono is still the default for the monospace alias even if ~/.config/fontconfig/fonts.conf doesn't exist.


Jin, Jîyan, Azadî

Offline

#7 2022-02-18 13:54:06

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: [Solved] Monospace font problem

should produce a config file

The actual filename/path is gonna be important so it takes precedence over whatever configures "Font Awesome 6 Brands"
Try eg. ~/.config/fontconfig/conf.d/99-monospace.conf and nb. that this has typically no impact on running processes (ie. you'll have to restart the browser afterwards)

Offline

#8 2022-02-18 14:24:18

Jack_CM
Member
Registered: 2012-02-10
Posts: 55

Re: [Solved] Monospace font problem

seth wrote:

should produce a config file

The actual filename/path is gonna be important so it takes precedence over whatever configures "Font Awesome 6 Brands"
Try eg. ~/.config/fontconfig/conf.d/99-monospace.conf and nb. that this has typically no impact on running processes (ie. you'll have to restart the browser afterwards)

That's it, there was indeed a stray config file there from a deepin installation I even forgot about. It was pointing to a font not present in my system and therefore it was being replaced with the first one it could find (I guess awesome is the first one in alphabetical order)

Thanks a lot

Offline

Board footer

Powered by FluxBB