Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not recognized as monospace by fontconfig #840

Closed
iyzana opened this issue Sep 14, 2019 · 3 comments
Closed

Not recognized as monospace by fontconfig #840

iyzana opened this issue Sep 14, 2019 · 3 comments

Comments

@iyzana
Copy link

iyzana commented Sep 14, 2019

The font is not recognized as monospace by some applications (see my initial ticket for the kitty terminal kovidgoyal/kitty#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 b32369c

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)
@ksonj
Copy link

ksonj commented Sep 14, 2019

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 🎉

@tonsky
Copy link
Owner

tonsky commented Sep 16, 2019

@tonsky tonsky closed this as completed Sep 16, 2019
@polarathene
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants