How do I turn off font pixel antialiasing only in Terminal?

For programming, I like to turn off font antialiasing (i.e. select the Monochrome option) because it makes the terminal text look a lot sharper at smaller font sizes. But then everything in the web browser looks worse.

Is there a way to have the best of both worlds, and have non-antialiased Terminal fonts, but antialiased web browser fonts?


You can control the antialiasing of fonts in ~/.fonts.conf. Doing so on an individual program basis requires some trickery, though.

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
  <dir>~/.fonts</dir>
  <alias>
    <family>XTerm</family>
    <prefer><family>Envy Code R</family></prefer>
    <default><family>monospace</family></default>
  </alias>
  <match target="pattern">
    <test name="family">
      <string>XTerm</string>
    </test>
    <edit mode="assign" name="family">
      <string>Envy Code R</string>
    </edit>
    <edit mode="assign" name="antialias">
      <bool>false</bool>
    </edit>
  </match>
</fontconfig>

This creates a font alias called XTerm which maps to Envy Code R but disables antialiasing. Run fc-cache ~/.fonts, and you should then be able to select that font in Terminal.

If you don't mind (or even prefer) the font used in the Terminal always being non-antialiased in any program, it's a bit simpler:

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
  <dir>~/.fonts</dir>
  <match target="pattern">
    <test name="family">
      <string>Envy Code R</string>
    </test>
    <edit mode="assign" name="antialias">
      <bool>false</bool>
    </edit>
  </match>
</fontconfig>

which doesn't require any other font hackery and insures that Envy Code R is always antialiased.

You can also constrain the font sizes where antialiasing can be performed:

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
  <dir>~/.fonts</dir>
  <match target="pattern">
    <test name="family">
      <string>Envy Code R</string>
    </test>
    <test name="size" qual="any" compare="less">
      <double>8</double>
    </test>
    <edit mode="assign" name="antialias">
      <bool>false</bool>
    </edit>
  </match>
</fontconfig>

to prevent antialiasing for Envy Code R when it is smaller than 8 point.

This article on the Arch Wiki shows how to tweak fonts in more detail. man fonts.conf is a reference to the configuration language, but without much in the way of practical examples.


I have spent lots of time mucking with font and system configurations to get a decent non-anti-aliased font in Ubuntu Terminal. One solution was to install a dedicated non-anti-aliased TrueType font, such as Terminus. Set your Terminal preferences to use the Terminus 8 font, or use the Ubuntu Advanced Settings tool to set the global console font to Terminus 8.

sudo apt-get install xfonts-terminus console-terminus

I've yet to find a solution that lets me use my favourite font (X11 6x13) in Terminal. In the mean time, I have been using pterm and Putty instead of Terminal. The only downside is that pterm and Putty don't support tabs.