Ubuntu – Disabling the anti-aliasing for a specific font with user’s fonts.conf

antialiasingfonts

Purpose:

I am trying to disable anti-aliasing via ~/.config/fontconfig/fonts.conf for a specific font, but so far without success. If my understanding is correct, then the cause is, that the system wide configuration takes precedence over my own config.

Question:

How to disable the anti-aliasing for a specific font with user's fonts.conf and taking precedence over the system wide configuration?

Side remark: I prefer doing it without touching the system configuration and I prefer not to do it on the application level.

Details:

System is Ubuntu Raring Ringtail 13.04. This is my ~/.config/fontconfig/fonts.conf:

<?xml version="1.0"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="pattern">
    <test name="family">
      <string>DejaVu Sans Mono</string>
    </test>
    <edit name="antialias" mode="assign">
      <bool>false</bool>
    </edit>
  </match>
</fontconfig>

The relevant files in /etc/fonts/conf.d are

  • 10-antialias.conf
  • 50-user.conf

with the following contents:

   /etc/fonts/conf.d>cat 10-antialias.conf 50-user.conf
   ...
   <match target="font">
     <edit name="antialias" mode="assign"><bool>true</bool></edit>
   </match>
   ...
   <include ignore_missing="yes" prefix="xdg">fontconfig/fonts.conf</include>
   ...

And this is what fc-match returns:

~>fc-match -v 'DejaVu Sans Mono' family antialias
Pattern has 2 elts (size 16)
        family: "DejaVu Sans Mono"(s)
        antialias: FcTrue(w)

Please note, that antialias is FcTrue!

Best Answer

[I know this question is 5 years old, but it still appears in search engines.]

I just made a .fonts.conf file in the Home directory. It worked right away in Ubuntu 18.04 LTS.

(Replace the font names accordingly!)

<!-- 
~/.fonts.conf

Remember to run "fc-cache" after you modify this file.
-->

<fontconfig> 

  <match target="font">
    <test name="family" qual="any">
      <string>Ubuntu Mono</string>
      <string>Free Pixel</string>
    </test>
    <edit name="antialias" mode="assign">
      <bool>false</bool>
    </edit>
  </match>

</fontconfig>

I put it into a Gist, plus some additional documentation just in case: https://gist.github.com/gonzalocesar/7ef41572a2627b65da976001a29ba7ee