Firacode: Not recognized as monospace by fontconfig

Created on 14 Sep 2019  路  3Comments  路  Source: tonsky/FiraCode

The font is not recognized as monospace by some applications (see my initial ticket for the kitty terminal https://github.com/kovidgoyal/kitty/issues/1968)
I believe the problem is that fontconfig reports the font as having spacing: 90(i)(s)
I ran git bisect and found this to be the case since commit https://github.com/tonsky/FiraCode/commit/b32369cb03ad3c0fe43fd30fd19427169e9592dc

font: FiraCode-Regular v2 otf
os: Arch Linux 5.2.14-arch2-1-ARCH
installed from arch repo community/otf-fira-code

My fc-list output:

Pattern has 25 elts (size 32)
        family: "Fira Code"(s)
        familylang: "en"(s)
        style: "Regular"(s)
        stylelang: "en"(s)
        fullname: "Fira Code Regular"(s)
        fullnamelang: "en"(s)
        slant: 0(i)(s)
        weight: 80(f)(s)
        width: 100(f)(s)
        spacing: 90(i)(s)
        foundry: "CTDB"(s)
        file: "/usr/share/fonts/OTF/FiraCode-Regular.otf"(s)
        index: 0(i)(s)
        outline: True(s)
        scalable: True(s)
        charset: 
        0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffffffff ffffffff ffffffff
        0001: ffffffff ffffffff ffffffff 7fffffff 00040000 00000000 00000000 f0000000
        0002: 0f000000 00800000 00000000 00000000 00000000 16000000 3f0002c0 00000000
        0003: 00189dff 006000c0 00000024 fcff0000 ffffd7f0 fffffffb ffffffff ffff0003
        0004: ffffffff ffffffff ffffffff 03ffffff fffffc00 ffffffff ffffffff ffffffff
        0005: ffffffff 0000ffff 00000000 00000000 00000000 00000000 00000000 00000000
        0014: 00000420 00000000 00000000 00000000 00000000 00000000 00000000 00000000
        001e: 00000000 00000000 00000000 00000000 4000003f 00000000 00000000 000c0000
        001f: 3f3fffff ffffffff aaff3f3f 3fffffff ffffffff ffdfffff efcfffdf 7fdcffff
        0020: 77fc0980 06010047 00000410 fff10000 00007fff 26009000 00000000 00000000
        0021: 00480000 00004004 fff80000 00000000 03ff0c00 00000200 c0000000 000007f0
        0022: 46268044 00300b80 00000100 00000037 00000000 0000fffc 00000000 00000000
        0023: 0101007d 000009f3 00000000 00000000 f8000980 00003fff 0000c000 00000000
        0024: ffffffff 0000007f 00000000 00000000 00000000 00000000 00000000 00000000
        0025: ffffffff ffffffff ffffffff ffffffff ffffffff 1444fc0f feefced1 00ff8fbf
        0026: 00070000 1e000001 00000005 00000c69 00000000 00000000 00000000 00000000
        0027: 00080000 00000000 00000000 00000000 00000000 00000002 00000000 ffff0300
        002b: 000000e0 00000000 00000000 00000000 00000000 00000000 00000000 00000000
        00e0: 0000000f 00000000 00000000 00000000 00000000 000f0007 00000000 00000000
        00fe: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 80000000
        01f3: 00010000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
(s)
        lang: aa|ab|af|av|ay|ba|be|bg|bi|br|bs|bua|ca|ce|ch|chm|co|cs|cu|cv|cy|da|de|el|en|eo|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl|gv|ho|hr|hu|ia|id|ie|ik|io|is|it|kaa|ki|kk|kl|ku-am|kum|kv|ky|la|lb|lez|lt|lv|mg|mh|mk|mo|mt|nb|nds|nl|nn|no|nr|nso|ny|oc|om|os|pl|pt|rm|ro|ru|sah|se|sel|sh|shs|sk|sl|sma|smj|smn|so|sq|sr|ss|st|sv|sw|tg|tk|tl|tn|tr|ts|tt|tyv|uk|uz|vo|vot|wa|wen|wo|xh|yap|zu|an|crh|csb|fil|hsb|ht|jv|kj|ku-tr|kwm|lg|li|mn-mn|ms|na|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|ty|za(s)
        fontversion: 131072(i)(s)
        capability: "otlayout:DFLT otlayout:cyrl otlayout:grek otlayout:latn otlayout:zinh otlayout:zyyy"(s)
        fontformat: "CFF"(s)
        decorative: False(s)
        postscriptname: "FiraCode-Regular"(s)
        color: False(s)
        symbol: False(s)
        variable: False(s)

Most helpful comment

I'm having the same issue and am working around it by overwriting the spacing in fontconfig:

Create the file /etc/fonts/conf.d/80-firacode-spacing.conf:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="scan">
    <test name="family">
      <string>Fira Code</string>
    </test>
    <edit name="spacing">
      <int>100</int>
    </edit>
  </match>
</fontconfig>

Then update the font-cache: sudo fc-cache -vf

fc-list "Fira Code" should now report a spacing of 100 and kitty list-fonts should list Fira Code as available :tada:

All 3 comments

I'm having the same issue and am working around it by overwriting the spacing in fontconfig:

Create the file /etc/fonts/conf.d/80-firacode-spacing.conf:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="scan">
    <test name="family">
      <string>Fira Code</string>
    </test>
    <edit name="spacing">
      <int>100</int>
    </edit>
  </match>
</fontconfig>

Then update the font-cache: sudo fc-cache -vf

fc-list "Fira Code" should now report a spacing of 100 and kitty list-fonts should list Fira Code as available :tada:

@ksonj Your solution is not working for me. I have tried this with "Noto Sans Mono" which has advance widths of (0, 600, 1200, 1800) afaik, which provides no spacing value at all. Using your config example, fc-match will return the font and show spacing of 100, but fc-list does not pick up on it, even after fc-cache.

Any ideas why that might be? Would you be able to confirm if you can do the same for "Noto Sans Mono" so that I can know if it's something with my system or font specific?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

magnus-madsen picture magnus-madsen  路  3Comments

Photonico picture Photonico  路  3Comments

ghivert picture ghivert  路  4Comments

RustemB picture RustemB  路  4Comments

Igorgro picture Igorgro  路  3Comments