Getting Beautiful Fonts in Gentoo Linux

Here’s my easy and modern guide to getting pleasant looking fonts on Gentoo with minimal effort.

Wikipedia rendered with the end result of this guide

Wikipedia rendered with the end result of this guide

USE Flags

Enable the following USE flags:

euse --enable truetype type1 cleartype corefonts

and make sure everything is built with them enabled:

emerge -uDNa world

Emerge Fonts

X.org and other apps should pull in some common fonts.  Here are some additional fonts useful for OpenOffice and other programs.  Dejavu provides excellent default fonts which we will enable in the next section.

app-admin/eselect-fontconfig
media-fonts/corefonts
media-fonts/dejavu
media-fonts/font-bh-ttf
media-fonts/font-bh-type1
media-fonts/freefonts
media-fonts/ttf-bitstream-vera
media-fonts/unifont
media-fonts/artwiz-aleczapka-en

Enabling fontconfig options

Use ‘eselect fontconfig list‘ to see a list of available configuration options.

eselect fontconfig list

eselect fontconfig list

Try enabling the following with ‘eselect fontconfig enable <num from list above>’:

10-autohint.conf
10-sub-pixel-rgb.conf
20-unhint-small-dejavu-sans-mono.conf
20-unhint-small-dejavu-sans.conf
20-unhint-small-dejavu-serif.conf
25-unhint-nonlatin.conf
57-dejavu-sans-mono.conf
57-dejavu-sans.conf
57-dejavu-serif.conf

This will give you very nice hinted fonts suitable for the great majority of RGB LCD displays.

The 57- series rules enable dejavu fonts as the default Serif and Sans Serif fonts.  This will improve the look of your desktop environment and programs like Firefox immediately.

~/.fonts.conf

This file controls your user fontconfig settings.  We will reiterate RGB hinting and disable it for bold fonts so they are not overly bold.  There are plenty of other tricks you can perform in this file to get more Windows-like text, but I’m quite satisfied with the following and find it very easy to read.

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
 <match target="font">
 <edit mode="assign" name="rgba">
 <const>rgb</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>
 <match target="font">
 <edit mode="assign" name="antialias">
 <bool>true</bool>
 </edit>
 </match>
 <!-- Disable autohint for bold fonts so they are not overly bold -->
 <match target="font" >
 <test compare="more" name="weight" >
 <const>medium</const>
 </test>
 <edit mode="assign" name="autohint" >
 <bool>false</bool>
 </edit>
 </match>
</fontconfig>

Conclusion

Please share any thoughts and tips in the comments.  I recommend browsing the X.org Font Guide on Gentoo Wiki, though some of the information there is out of date or more complex than the method I just outlined.

Share this article:
  • Reddit
  • HackerNews
  • Slashdot
  • Facebook
  • StumbleUpon
  • Google Bookmarks
  • FSDaily
  • Twitter
  • Identi.ca
  • Digg
  • del.icio.us
  • Print
  • email
  • PDF

Related posts:

  1. To users that miss xorg.conf and complain about it I get requests from users and see questions all the...
  2. KDE 4.2 beta 1 on Gentoo KDE 4.2 is set for release on January 27th.  Eager...
  3. Gentoo 2007.0 Released! “The Gentoo project is pleased to announce the much-delayed release...
  4. KDE4 on Gentoo So I bit the bullet and installed KDE 4.0 on...
  5. Sun Ultra 27 Review – The Ultimate Linux Workstation Sun Microsystems has a powerful and favorably priced entry in...

This entry was posted in Computing, Gentoo, Linux, kde and tagged , , , , , . Bookmark the permalink.

18 Responses to Getting Beautiful Fonts in Gentoo Linux

  1. kucrut says:

    Thanks! You just made my day :)

  2. Jeremy Olexa says:

    I prefer *not* to have corefonts on my system. There are many more free alternatives.

  3. Dion Moult says:

    My own setup: http://e2-productions.com/imgbin/albums/fonts.png
    Using mainly “Liberation Sans” with this .fonts.conf

    <?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>
    

    Did not think about separate settings for bold fonts – will check it out.

  4. Pingback: Links 05/12/2009: KDE Software Compilation 4.4 (“Kompilation”) in Beta | Boycott Novell

  5. HS says:

    I have to say I do not like it. It looks too blurry (on your screenshot and on my desktop if I enable those fontconfig options; it is most visible on the menu bar). But if I disable the ’10-autohint.conf’ (and leave the ’10-sub-pixel-rgb.conf’) then it looks awesome – sharp; except for KDE 4 applicattions – they have more blurred fonts, maybe they are now doing double subpixel rendering or so, not sure where is the problem.

  6. Alessandro says:

    A little of topic…How to obtain correct visualization of languages like Gujarati or Malayalam in Firefox? I see that in your wikipedia screenshot, you’re able too visualize these characters correctly…but I can’t. I see just rectangles…
    How to see everything properly like you?

  7. Mike Bonar says:

    Thanks for that excellent guide.

  8. kev009 says:

    @HS
    You may want to double check your monitor type. This guide was written assuming RGB LCD displays, and you need to make sure Xorg recognizes the DPI properly. If you have a BGR display (somewhat rare but I had one.. the Dell 1800FP) you will need to enable that .conf instead.

    KDE apps have additional settings in System Settings->Appearance->Fonts. You can disable hinting there as well.

    @Alessandro
    This should be covered by the font list I provided.

  9. pedro says:

    Sorry man but your font rendering is terrible. I’m just trying to get the fonts working right because they look exactly the same way on my machine ;-)

    Generally speaking, I found out (so far) that Firefox either use its own rendering or at least its own settings for cairo and/or freetype. Fonts in Firefox always look great as they do on your screenshot. Unfortunatelly this has nothing to do with your fonts settings. Firefox simply ignores these. Thus the only relevant part of your screenshot is the top menubar with blurry fonts. You’ll findout for yourself that any other application in your system renders fonts exactly in this ugly way and not in the way Firefox rendered Wikipedia page for you.

    My tip is to disable bindist for freetype but not sure whether this will help. I’ll give it a try ;-)

  10. Nick Black says:

    I’d also recommend the (unfree) Mathematica fonts, as pulled in by Debian’s mathematica-fonts package:

    http://packages.debian.org/sid/mathematica-fonts

  11. pedro says:

    Do not ask people to share their thoughts if you do not like to hear their opinion. I pointed out yesterday that Firefox renders fonts on itself and therefore the only relevant part of your screenshot is the top menu that really has the fonts blurry to my liking. You deleted this almost immediately ;-)
    Well, I solved the issue for myself and came back to share the solution with you and other people here. But having the experience with your nazi behavior, I simply will not. Enjoy you crappy fonts :-)))

  12. kev009 says:

    @pedro
    First, I didn’t delete your post. I moderate posts so my site doesn’t become a spam bucket. I must have missed the point where you pay for my bandwidth or time it requires to do this, so sorry for only doing it every week or so ;-).

    YES, DISABLE BINDIST on freetype. This allows for the hinting as required by the settings in this guide.

    Also, this is the first time I’ve been victim to Godwin’s law :-O.

  13. Arc says:

    Thanks for the list of fonts.

    “euse –enable truetype type1 cleartype corefonts”

    Should be “type3″.

  14. brebs says:

    pedro, use Firefox’s –enable-system-cairo

    All, read the huge Gentoo fonts thread if you want your desktop pretty:
    http://forums.gentoo.org/viewtopic-p-6183606.html#6183606

    Ubuntu’s patches should be used, if you *really* care about your font rendering.

  15. Daniel says:

    w00t! very helpful, thanks!! =)

  16. Bob says:

    My eyes, my eyes, arggghh….

    The fonts were so blurry that I wanted to gouge them out. Disabling cleartype in cairo solved them problem. Very happy with the result now. Cheers.

  17. ogredeschnique says:

    Thanks for the guide.

    My fonts were not blurry enough. They were fat in some areas instead of fading and looking smooth.

  18. Isaac says:

    Thanks!! Looks so much better. And it fixed an odd issue in Chromium with squares/boxes showing up in Gmail and other random pages.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>