9

By default, the monospace font for my distribution (Trisquel) is Font A. I would like to change it to font B. Some time ago, I managed to make a partial change to Font C, but I have since forgotten this method and cannot reproduce it.

The trouble is that now I may see all three fonts in monospaced contexts. Using gnome-tweak-tool as both root and user, I have changed the "monospace" field to Font B. I have also done this via the command line on gsettings, again as both root and user. However:

  • If a web page requests the style {font-family: monospace;}, Font C displays. Edit: this was a setting in Firefox, which I have changed.
  • In the Inkscape and gedit font menus, there is a font called simply "Monospace", which is font A. My distribution's default UI fonts, which I have changed, also display in these menus under the names "Sans" and "Serif".
  • When Thunderbird messages I have received are formatted as plain text, they are displayed in Font A. Unless explicitly changed, messages I write also display in the fonts "Sans" and "Monospace".

How can I fix this situation, such that Font B displays in all contexts described above, and the mysterious "Sans" font is replaced by the UI font I am currently using?

9

Add this to yours ~/.config/fontconfig/fonts.conf file to set Font B as default monospace font

 <match target="pattern">
  <test name="family" qual="any">
   <string>monospace</string>
  </test>
  <edit binding="strong" mode="prepend" name="family">
   <string>Font B</string>
  </edit>
 </match>

Or to /etc/fonts/local.conf to set it system-wide

  • 1
    The file did not exist, so I created it and added that text to it, surrounded by <?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"><fontconfig> and </fontconfig>. It did not work, even after running sudo fc-cache -f -v. – Lee Sleek Dec 21 '13 at 19:34
  • To be clear, no need to add <?xml... or anything else to that file. Its exactly as it is shown above. Save. Then you can test if its working with: fc-match monospace (be sure "Font B" exists under that name). If you need more than one rule, wrap it around <fontconfig> tag. – lepe Aug 21 '17 at 6:17
  • This works, but how does one set the size as well? I tried Font B 14 and it didn't work. – legends2k Jun 12 '18 at 16:20
2

I found this to be working:

gsettings set org.gnome.desktop.interface monospace-font-name 'Noto Mono 11' (Probably not all apps, gedit changes instantly)

0

I figured it out by searching the system for the name of Font A. There should be a file (more accurately, a link to a file) "/etc/fonts/conf.d/01-trisquel.conf". You will need to edit this file to include the names of your chosen fonts as highest priority (above the existing <family> entries).

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.