Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When I used Windows (a very very long time ago!), and Mac OS X, there was always a central "repository" of fonts shared and accessed by the OS and all programs (the font folder in Windows, and Font Book in Mac OS X).

How are fonts managed in Linux? Is there also a central store for fonts that all programs (the shell with no X, with X, window managers, other GUI software) can use? Or are fonts managed separately? What can I do to efficiently and easily manage my fonts in Linux?

share|improve this question
add comment

2 Answers

up vote 12 down vote accepted

There are two mechanisms for fonts in X land: server-side and client-side.

The traditional way to render fonts is for the client to tell the server “render foo at position (x,y) in font F” (where a font specification includes a face, size, encoding and other attributes). Either the X server itself, or a specialized program called a font server, opens the font file to build the description of each glyph. The fonts can be bitmap or vector fonts, but the vector fonts are converted to bitmaps before rendering.

Most modern programs use client-side font rendering, often through xft and fontconfig. A new mechanism was needed because the server-side font rendering didn't support anti-aliasing.

Outside X (i.e. on a VGA console), there are VGA fonts, which are bitmap fonts of specific sizes. But compared to X11, no one uses the VGA console, so not much effort is spent on them.

In practice, you'll want to configure fonts in two ways:

  • For older-style programs: the font directories are listed via FontPath directives in xorg.conf and can be manipulated with xset fp commands by the user running X. If you install new fonts, you may need to run mkfontdir.
  • For newer-style programs, including all Gtk (Gnome, etc.) and Qt (KDE, etc.) programs: fonts are in the directories indicated by <dir> directives in /etc/fonts/fonts.conf, ~/.fonts.conf and a few other places. See the fontconfig documentation for more information. If you install new fonts, you may need to run fc-cache.
share|improve this answer
add comment

Console fonts and X fonts are two separate things in linux. Use the command setfont to change your font, and showconsolefont to see what it looks like. Each distro has it's own way of setting the default console font. Read the setfont man page for the location of the console fonts. For my Fedora 14 system, it's /lib/kbd/consolefonts/. Console fonts are a file format that define EGA/VGA console fonts.

X Fonts are a different format than console fonts. They are typically handled by definitions in your X config (with FontPath in the Files section), or through a Font server (xfs), which is also set in the Files section with FontPath. You can also add FontPaths by running xset +fp path. My system has all it's X fonts in /usr/share/X11/fonts.

share|improve this answer
    
So does that mean all GUI programs that runs on X will use the X fonts? –  hpy Feb 15 '11 at 22:00
1  
@penyuan: Not necessarily, but for the majority of cases, yes. Many GUI programs use higher-level libraries (like GTK or Qt) that manage the fonts for you. –  jsbillings Feb 16 '11 at 15:52
    
Note that documents (e.g. (La)TeX) use yet another set of fonts. –  vonbrand Jan 18 '13 at 0:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.