0

I'm trying to set the default style of a font in fonts.conf because for whatever reason the bold version always gets matched:

$ fc-match monospace
LigaOperatorMonoSSm-Bold.otf: "Liga Operator Mono SSm" "Bold"

This is my fonts.conf:

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
  <edit name="antialias" mode="assign"><bool>true</bool></edit>

  <match target="pattern">
    <test qual="any" name="family"><string>Liga Operator Mono SSm</string></test>
    <edit name="style" mode="assign" binding="same"><string>Medium</string></edit>
  </match>

  <alias>
    <family>serif</family>
    <prefer><family>Circular Std</family></prefer>
  </alias>
  <alias>
    <family>sans-serif</family>
    <prefer><family>Circular Std</family></prefer>
  </alias>
  <alias>
    <family>sans</family>
    <prefer><family>Circular Std</family></prefer>
  </alias>
  <alias>
    <family>monospace</family>
    <prefer><family>Liga Operator Mono SSm</family></prefer>
  </alias>
  <alias>
    <family>terminal</family>
    <prefer><family>Liga Operator Mono SSm</family></prefer>
  </alias>
</fontconfig>

As you can see, I've tried to set the default width to Medium but it unfortunately does not work. These are the available styles:

/usr/share/fonts/OTF/LigaOperatorMonoSSm-LightItalic.otf: Liga Operator Mono SSm:style=Light Italic,Italic
/usr/share/fonts/OTF/LigaOperatorMonoSSm-MediumItalic.otf: Liga Operator Mono SSm:style=Medium Italic,Italic
/usr/share/fonts/OTF/LigaOperatorMonoSSm-Medium.otf: Liga Operator Mono SSm:style=Medium,Regular
/usr/share/fonts/OTF/LigaOperatorMonoSSm-BoldItalic.otf: Liga Operator Mono SSm:style=Bold Italic,Italic
/usr/share/fonts/OTF/LigaOperatorMonoSSm-Book.otf: Liga Operator Mono SSm:style=Book,Regular
/usr/share/fonts/OTF/LigaOperatorMonoSSm-Bold.otf: Liga Operator Mono SSm:style=Bold,Regular
/usr/share/fonts/OTF/LigaOperatorMonoSSm-BookItalic.otf: Liga Operator Mono SSm:style=Book Italic,Italic
/usr/share/fonts/OTF/LigaOperatorMonoSSm-Light.otf: Liga Operator Mono SSm:style=Light,Regular

Does anyone see where the mistake is? Thanks!

2 Answers 2

0

Here's what I used to fix wrong metadata in Operator Mono:

 <!-- Fixup Operator Mono weights -->
 <match target="scan">
   <test name="family">
     <string>Operator Mono Bold</string>
   </test>
   <edit name="weight">
     <const>bold</const>
   </edit>
 </match>
 <match target="scan">
   <test name="family">
     <string>Operator Mono Book</string>
   </test>
   <edit name="weight">
     <const>book</const>
   </edit>
 </match>
 <match target="scan">
   <test name="family">
     <string>Operator Mono XLight</string>
   </test>
   <edit name="weight">
     <const>extralight</const>
   </edit>
 </match>

Don't forget to replace font name and to fc-cache -f afterwards.

0

I ran into the same problem (with a different font). This sort of thing is what worked for me:

<match target="pattern">
    <test name="family" compare="eq">
        <string>Liga Operator Mono SSm</string>
    </test>
    <edit name="style" mode="append">
        <string>Medium</string>
    </edit>
</match>

Basically this says whenever a search is made for family "Liga Operator Mono SSm", add "Medium" to the end of the list of styles to search for. So if there's some other style that's specified, that will take priority, but if there isn't, then "Medium" will be used to find a font.

...I think. The fontconfig documentation is a bit confusing tbh.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.