I have the font Fira Code installed on my computer but I can't target its bold variant using fontconfig in the same way I do with its other variants. Here's what fc-match
gives me:
$ fc-match "Fira Code"
FiraCode_Regular.otf: "Fira Code" "Regular"
$ fc-match "Fira Code Light"
FiraCode_Light.otf: "Fira Code" "Light"
$ fc-match "Fira Code Medium"
FiraCode_Medium.otf: "Fira Code" "Medium"
$ fc-match "Fira Code Bold"
NotoSans-Regular.ttc: "Noto Sans" "Regular"
Noto Sans is my fallback font which I think means that Fira Code Bold
doesn't have any matches with any of my fonts.
However, it does match the right one if I run fc-match
with Fira Code:Bold
.
$ fc-match "Fira Code:Bold"
FiraCode_Bold.otf: "Fira Code" "Bold"
Following this question, I created a file called 30-fira-code-bold.conf
within ~/.config/fontconfig/conf.d/
with the following content:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="pattern">
<test name="family"><string>Fira Code</string></test>
<test name="weight" compare="more_eq"><const>bold</const></test>
<edit name="family" mode="assign" binding="strong"><string>Fira Code Bold</string></edit>
</match>
</fontconfig>
and then I ran fc-cache -rv
and logged out but it still gives me Noto Sans if I run $ fc-match "Fira Code Bold"
. The only difference I have noticed is that it gives me Noto Sans even if I run $ fc-match "Fira Code:Bold"
; so basically I can't target the bold variant of Fira Code in any way now.
I'm running Archlinux, if it can help, and this is the output of fc-list
:
$ fc-list "Fira Code" | egrep -o 'FiraCode.*'
FiraCode_Medium.otf: Fira Code,Fira Code Medium:style=Medium,Regular
FiraCode_Light.otf: Fira Code,Fira Code Light:style=Light,Regular
FiraCode_Regular.otf: Fira Code:style=Regular
FiraCode_Bold.otf: Fira Code:style=Bold
Can anyone tell me how I can target Fira Code Bold using "Fira Code Bold"?