NOTE: This is an older article, so the information provided may no longer be accurate.

Nice-Looking Fonts For Rebels

Are you a 'rebel'? Do you like to mix and match to create your own desktop environment? Do you use fluxbox with pcmanfm and lxpanel? Are you tired of having junky-looking fonts? Behold the issue at hand:

Yucky-looking fonts example
Look closely, and you can see problems with the non-Xfce fonts (right side)

Sometimes I like to let my hair down and dabble with different combinations of desktop environments, window managers, file managers and panels in Linux. I usually go back to using the complete Xfce package afterward, only because it seems to give me everything I need without the huge impact that Gnome or KDE can hit with. The problem is, if you aren't using a full DE package, font rendering can be pretty ugly (as seen in the example image above).

 

God loves geeks too!
Why Jesus?

 

There are usually three files in your home directory that can make a huge difference with font-rendering, .fonts.conf, .gtkrc-2.0 and .Xresources, though sometimes even getting those settings right won't help you completely. You need to clue your X server into the contents of the .Xresources file, and then that usually whips those fonts into shape.

I like full, clear-looking fonts, myself. Here are the relevant portions of the above-mentioned files that might help others get what they're looking for:

 

~/.fonts.conf

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

</fontconfig>

 

~/.gtkrc-2.0

[...snip...]

gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle="hintslight"
gtk-xft-rgba="none"
gtk-xft-dpi=96

 

~/.Xresources

Xft.dpi: 96
Xft.antialias: true
Xft.hinting: true
Xft.rgba: none
Xft.autohint: false
Xft.hintstyle: hintslight
Xft.lcdfilter: lcddefault

Oh yes, almost seems redundant, doesn't it? I tell you, though, nearly all of the apps I use on a regular basis look at at least one of those files, so it's best to have all of them available and setting the same properties.

If you are using Xfce, Gnome, KDE, and others, those environments give the X server hints as to how the fonts should be rendered. But if you're cobbling different stuff together to make your own unique 'FrankenDesktop', it's a fair bet the X server isn't going to get the font-rendering hint unless you issue the following command in your startup script:

xrdb -all ~/.Xresources

What's that mysterious command all about? The xrdb man page says:
"Xrdb is used to get or set the contents of the RESOURCE_MANAGER property on the root window of screen 0, or the SCREEN_RESOURCES property on the root window of any or all screens, or everything combined. You would normally run this program from your X startup file."

So entering your desired font-rendering settings into the right files is half the battle, but letting X know about those settings is the other half. Have fun, ya rebel! :-D

 

Post A Comment

Your name:

Your e-mail address: (Will not be seen or used by anyone else but me)

To help cut down on spam, what do you get when you add two and four?:

Please type your message below: (Please limit message to less than 1,000 characters)

By submitting your comment, you consent to me posting it on my site.

All submissions are moderated before being posted and any profanity or sensitive information blanked out.

My Story   |   Today God is First!   |   Autism
 
This page should pass HTML validation. Standards-compliance is important to me.