You are not logged in.

#1 2018-10-30 19:18:51

andrzej1_1
Member
Registered: 2017-09-07
Posts: 50

[SOLVED] Google Chrome does not fallback to monospace fonts

Hello! I have a problem with Google Chrome, namely sites (eg. Github, Ideone) with monospace fonts does not look proper:
ideone.png

If there is style font-family: monospace; then font is correct, but in case of font-family: 'nonexisitngfont', monospace; Chrome fallbacks to Noto Sans:
1540925982.png

Fonts are displayed correctly in Firefox, but this is rather problem with system configuration than Chrome issue. There is already similar thread, but it is unresolved.

This is fc-match output:

$ fc-match "nonexistingfont"
NotoSans-Regular.ttf: "Noto Sans" "Regular"
$ fc-match monospace
Hack-Regular.ttf: "Hack" "Regular"

Installed font packages:

$ pacman -Qqem | grep font
nerd-fonts-complete
ttf-google-fonts-git
ttf-ms-fonts
ttf-unifont

What can be wrong?

Last edited by andrzej1_1 (2018-11-02 21:39:11)

Offline

#2 2018-10-31 16:42:28

seth
Member
Registered: 2012-09-03
Posts: 19,805

Re: [SOLVED] Google Chrome does not fallback to monospace fonts

Resolving default sans is pretty normal if you feed some crap, but chromium should™ be aware that there's no perfect match and go down the css list.
Is this "chrome" or "chromium"? (In chromium, when removing monaco -installed- from the list it skips menlo and resolves consolas fine here, while "fc-match menlo" leaves me w/ dejavu sans - as expected)

Offline

#3 2018-11-01 20:56:47

andrzej1_1
Member
Registered: 2017-09-07
Posts: 50

Re: [SOLVED] Google Chrome does not fallback to monospace fonts

Problem is present in latest version of both browsers (Google Chrome, Chromium).

Offline

#4 2018-11-01 21:08:20

seth
Member
Registered: 2012-09-03
Posts: 19,805

Re: [SOLVED] Google Chrome does not fallback to monospace fonts

No idea, as mentioned in the other thread it's entirely not reproducible (never has been)
Wild guess:

pacman -Q | grep -E '(font|harf|chrom)'

Offline

#5 2018-11-02 21:38:51

andrzej1_1
Member
Registered: 2017-09-07
Posts: 50

Re: [SOLVED] Google Chrome does not fallback to monospace fonts

I finally found the cause of problem: reddit guide. After removing /etc/fonts/local.conf file, fonts are displayed correctly.

Offline

#6 2018-11-02 21:42:33

seth
Member
Registered: 2012-09-03
Posts: 19,805

Re: [SOLVED] Google Chrome does not fallback to monospace fonts

Where does that thread suggest to remove that file, what was in it and how did it end up there itfp? Is it provided by any package you installed?

Offline

#7 2018-11-04 11:17:17

andrzej1_1
Member
Registered: 2017-09-07
Posts: 50

Re: [SOLVED] Google Chrome does not fallback to monospace fonts

That guide shows how improve fonts rendering (no bitmaps, hinting etc.) and one of presented steps is to create /etc/fonts/local.conf with following content:

  <?xml version="1.0"?>
  <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
  <fontconfig>
      <match>
          <edit mode="prepend" name="family"><string>Noto Sans</string></edit>
      </match>
      <match target="pattern">
          <test qual="any" name="family"><string>serif</string></test>
          <edit name="family" mode="assign" binding="same"><string>Noto Serif</string></edit>
      </match>
      <match target="pattern">
          <test qual="any" name="family"><string>sans-serif</string></test>
          <edit name="family" mode="assign" binding="same"><string>Noto Sans</string></edit>
      </match>
      <match target="pattern">
          <test qual="any" name="family"><string>monospace</string></test>
          <edit name="family" mode="assign" binding="same"><string>Noto Mono</string></edit>
      </match>
  </fontconfig>

It appears such file breaks font fallback in Chrome, so I just deleted it.

Offline

#8 2018-11-04 14:02:35

seth
Member
Registered: 2012-09-03
Posts: 19,805

Re: [SOLVED] Google Chrome does not fallback to monospace fonts

Ah, the link *is* the cause, it doesn't explain the solution.

This breaks because it unconditionally makes noto sans a legal match to everything.
This is outright stupid, you can keep the noto defaults if you want, but remove the

<match>
     <edit mode="prepend" name="family"><string>Noto Sans</string></edit>
</match>

part.

Offline

#9 2018-11-04 18:48:24

andrzej1_1
Member
Registered: 2017-09-07
Posts: 50

Re: [SOLVED] Google Chrome does not fallback to monospace fonts

It works perfectly!

Last edited by andrzej1_1 (2018-11-06 09:19:58)

Offline

#10 2021-04-07 06:27:47

harshithg
Member
Registered: 2016-07-31
Posts: 1

Re: [SOLVED] Google Chrome does not fallback to monospace fonts

seth wrote:

Ah, the link *is* the cause, it doesn't explain the solution.

This breaks because it unconditionally makes noto sans a legal match to everything.
This is outright stupid, you can keep the noto defaults if you want, but remove the

<match>
     <edit mode="prepend" name="family"><string>Noto Sans</string></edit>
</match>

part.

Thanks a lot, this worked for the Edge browser!

Offline

#11 2021-04-07 06:44:23

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 12,524

Re: [SOLVED] Google Chrome does not fallback to monospace fonts

Glad to hear, however please don't necrobump 3 year old threads

Closing.

Offline

Board footer

Powered by FluxBB