You are here

Smooth Fonts

Uditha Atukorala's picture
AttachmentSize
font-config.tar.gz895 bytes

Ever wanted to have smooth and nice fonts in Linux? Well, there are few things that you can do.

I tried these steps on Debian Lenny (Testing) and they did make the fonts smooth and readable. But I must admit my fonts looks good but not as good as in Windows Vista but far better than in Windows XP.

1 - Install Microsoft True Type Fonts
# aptitude install msttcorefonts

This will install the following true-type fonts into your system.

  • Andale Mono
  • Arial Black
  • Arial (Bold, Italic, Bold Italic)
  • Comic Sans MS (Bold)
  • Courier New (Bold, Italic, Bold Italic)
  • Georgia (Bold, Italic, Bold Italic)
  • Impact
  • Times New Roman (Bold, Italic, Bold Italic)
  • Trebuchet (Bold, Italic, Bold Italic)
  • Verdana (Bold, Italic, Bold Italic)
  • Webdings
2 - Edit the .font.conf
You should have a font configuration file named .font.conf in your home directory. This file can be used to override the default configuration.

Backup your existing configuration first,

$ cd ~
$ mv .font.conf .font.conf.back

Create a new .font.conf file to override the configuration.

$ nano ~/.font.conf

Here are some configurations that you can try,
Note: You can also find these configurations in the attached file.

Configuration - 1 (Originally posted here)

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- Disable sub-pixel rendering. X detects it anyway, and if you set
this as well, it just looks really horrible  -->
<match target="font" >
  <edit mode="assign" name="rgba" >
   <const>none</const>
  </edit>
</match>
<match target="font" >
  <edit mode="assign" name="hinting" >
   <bool>true</bool>
  </edit>
</match>
<match target="font" >
  <edit mode="assign" name="hintstyle" >
   <const>hintfull</const>
  </edit>
</match>
<!-- The first part of the 'magic.' This makes the fonts start to look
nice, but some of the shapes will be distorted, so hinting is needed
still -->
<match target="font" >
  <edit mode="assign" name="antialias" >
   <bool>true</bool>
  </edit>
</match>
<!-- Autohinter is not turned on automatically. Only disable this if you
have recompiled Freetype with the bytecode interpreter, which is run
automatically. Although to be honest, Freetype are right, there isn't
much difference between the two. Note that OpenOffice is built against
the bytecode interpreter, so even if you have compiled it and override
it with the autohinter, OOo will still use the bytecode interpreter -->
<match target="pattern" >
  <edit mode="assign" name="autohint" >
   <bool>true</bool>
  </edit>
</match>
<!-- Helvetica is a non true type font, and will look bad. This replaces
it with whatever is the default sans-serif font -->
<match target="pattern" name="family" >
  <test name="family" qual="any" >
   <string>Helvetica</string>
  </test>
  <edit mode="assign" name="family" >
   <string>sans-serif</string>
  </edit>
</match>
<dir>~/.fonts</dir>
</fontconfig>


Configuration - 2
(Originally posted here)

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="font" >
  <edit mode="assign" name="autohint" >
   <bool>true</bool>
  </edit>
</match>
<match target="font" >
  <edit mode="assign" name="rgba" >
   <const>none</const>
  </edit>
</match>
<match target="font" >
  <edit mode="assign" name="hinting" >
   <bool>false</bool>
  </edit>
</match>
<match target="font" >
  <edit mode="assign" name="hintstyle" >
   <const>hintnone</const>
  </edit>
</match>
<match target="font" >
  <edit mode="assign" name="antialias" >
   <bool>true</bool>
  </edit>
</match>
</fontconfig>

3 - Refresh
To be able to see the changes you'll have to restart your xserver.