Xorg Fonts Setup
This is a tutorial to get good looking fonts under Xorg, with anti-aliasing. It is taken from the Gentoo wiki.
Hardware
- It is said that having an monitor that does not do 96dpi will result in poor visual quality anyway. To know the dimension and DPI of your hardware use:
xrandr --query // this will give you the physical specifications of your monitor xdpyinfo | grep -B1 dot // this will give you the current DPI used by X
- The true DPI is obtained by dividing the resolution of your monitor by its width in inches.
USE flags
- Add the global truetype USE flag.
- Add -bindist to the media-libs/freetype package.
Installing Fonts
- Emerge the following fonts:
- media-fonts/corefonts
- media-fonts/freefonts
- media-fonts/ttf-bitstream-vera
- media-fonts/artwiz-fonts
- media-fonts/sharefonts
- media-fonts/terminus-font
- media-fonts/dejavu
- media-fonts/liberation-fonts-ttf
Configuration Files
- In xorg.conf you only need to change the font paths:
Section "Files"
FontPath "/usr/share/fonts/misc:unscaled"
FontPath "/usr/share/fonts/Type1"
FontPath "/usr/share/fonts/TTF"
FontPath "/usr/share/fonts/corefonts"
FontPath "/usr/share/fonts/freefonts"
FontPath "/usr/share/fonts/sharefonts"
FontPath "/usr/share/fonts/terminus"
FontPath "/usr/share/fonts/dejavu"
FontPath "/usr/share/fonts/cyrillic"
FontPath "/usr/share/fonts/ttf-bitstream-vera"
FontPath "/usr/share/fonts/75dpi:unscaled"
FontPath "/usr/share/fonts/100dpi:unscaled"
FontPath "/usr/share/fonts/artwiz"
EndSection
The order matters! Also make sure you are loading the freetype module.
- /etc/fonts/local.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/local.conf file to configure system font access -->
<fontconfig>
<!-- DO NOT Use the Autohinter -->
<match target="font">
<edit name="autohint" mode="assign"><bool>false</bool></edit>
</match>
<match target="pattern" name="family">
<test name="family" qual="any">
<string>Courier</string>
</test>
<edit name="family" mode="assign">
<!-- Other choices - Courier New, Luxi Mono -->
<string>Bitstream Vera Sans Mono</string>
</edit>
</match>
<match target="font">
<!--
<edit name="rgba" mode="assign">
<const>vrgb</const>
</edit>
-->
<edit name="autohint" mode="assign">
<bool>false</bool>
</edit>
<edit name="antialias" mode="assign">
<bool>true</bool>
</edit>
<edit name="hinting" mode="assign">
<bool>true</bool>
</edit>
<edit name="hintstyle" mode="assign">
<const>hintfull</const>
</edit>
</match>
<!-- Reject bitmap fonts in favour of Truetype, Postscript, etc. -->
<selectfont>
<rejectfont>
<pattern>
<patelt name="scalable">
<bool>false</bool>
</patelt>
</pattern>
</rejectfont>
</selectfont>
</fontconfig>
Testing
- To test, reload periodically xdm (/etc/init.d/xdm restart) while making changes to /etc/fonts/local.conf
- For testing
Mozilla Firefox Setup
- You can change the default fonts used in the Preferences. You should probably use Bitstream Vera, or the Red Hat Liberation family.
- Go to about:config, experiment with values such as font.FreeType2.enable, font.FreeType2.unhinted, font.FreeType2.autohinted.