You are not logged in.

#1 2020-02-13 20:51:40

alaskanarcher
Member
Registered: 2016-04-30
Posts: 50

[Solved] No monospace font in Firefox

I am not sure how to get monospace fonts to actually be selected by these applications where appropriate, such as on Github when displaying code snippets.

Monospace font works just fine in Terminator and other console applications, but in Chrome and Firefox it falls back to some non-monospace font.

Oddly, fc-match does not return a monospace font:

$ fc-match Monospace
NotoSans-Regular.ttf: "Noto Sans" "Regular"

My font config is:

<?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>

I have noto-fonts and noto-fonts-extra installed. Xorg is aware of the Noto font path:

$ xset q
...
Font Path:
  /usr/share/fonts/misc/,/usr/share/fonts/TTF/,/usr/share/fonts/ubuntu/,/usr/share/fonts/noto/,/usr/share/fonts/misc,/usr/share/fonts/TTF,built-ins
...

Any suggestions on how to go about debugging this?

Last edited by alaskanarcher (2020-02-17 02:28:13)

Offline

#2 2020-02-17 02:27:35

alaskanarcher
Member
Registered: 2016-04-30
Posts: 50

Re: [Solved] No monospace font in Firefox

I was able to finally solve this issue after reading a bit more about Font Configuration.

The fundamental issue way this section of my /etc/fonts/local.conf

    <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>

This was replacing the monospace family with Noto Mono. This font doesn't exist on my system. The Noto monospace font is called "Noto Sans Mono". By change "Noto Mono" to "Noto Sans Mono", fc-match then returns the correct font.

Offline

Board footer

Powered by FluxBB