Slashdot Mirror


Figuring Out the Font System on Linux Desktops?

koreth asks: "Last year I switched to Debian sarge on my office desktop machine. For the most part it's been great, but I can't seem to wrap my brain around fonts. For example, my favorite programming font is Sheldon Narrow. After running it through a few conversion tools and copying it to various font directories, I was able to start using it in xterm. But no sign of it in Konsole, despite running it through KDE's font installer tool. A few times I've installed new fonts that appear in the font lists of GNOME apps but not KDE apps or vice versa, and it's unclear to me how either environment's fonts interact with what I see when I run 'xlsfonts'. I have yet to find any documentation describing how either GNOME or KDE decides which fonts it likes. And then there's Debian's 'defoma', which seems to interact with everything somehow. Are there any good resources out there for learning what's going on under the hood of a modern Linux desktop environment's font subsystem?"

13 of 51 comments (clear)

  1. A good place to start... by Dirus · · Score: 5, Informative

    The Linux Documentation Project is a good place to start. Here is an article about the optimal use of fonts. It has a section called "Why Fonts on Linux Aren't Straight Forward?" and a section called "The Easy Steps to Enlighten Your Desktop" with KDE, Gnome, OpenOffice.org, and FireFox configuration examples.

    1. Re:A good place to start... by Anonymous Coward · · Score: 1, Informative
  2. A Few Documents to Read by linguae · · Score: 5, Informative

    One of the things that helped me install fonts is this paper. Yes, it's from the FreeBSD handbook, but nearly all of it deals with just X11 and not FreeBSD-specific.

    A few little tips; you might want to install the Microsoft web fonts (they're free as in beer and pretty nice) as well as the Bitstream Vera fonts. If you have a Windows box, you can copy those fonts, put them on your *nix box, and update the fonts database by typing ttmkfdir > fonts.dir where the TrueType fonts are stored.

    Pretty much, my experience with fonts have been, for the most part, pretty good. I'm using FreeBSD with Window Maker, so no, I don't have all of the nice KDE/GNOME bells and whistles, so my fonts might not look as good. However, it is a great idea to get a nice understanding of how fonts work under X11. You never know when you need it....

    As for the Sheldon font, X11 comes with a program called xfontsel. (Yes, it's ugly and it comes from the bad old days of X, and its description of fonts is a stark departure from Windows/Mac, but it does the job). Anyways, look under the fmly menu and see if your font is located there.

  3. Ok, this is what I know by reynaert · · Score: 5, Informative

    There basically two font subsystems on X, the old X core fonts and the new fontconfig.

    X core fonts are the old standard X11 stuff, with FonthPaths, fonts.dir and fonts.scale files, and lots of other nastiness. It has trouble with scalable fonts, it can't deal at all with complex scripts (such as Syriac or Indic scripts), and it can't do anti-aliasing or sub-pixel rendering ("ClearType"). Also it's completely useless if you want to print something.

    The new way, with fontconfig, is completely seperate (and in fact independent from X) and basically fixes all these flaws (but it introduces the nastiness of XML config files). By now the only interesting application that hasn't been converted yet is Emacs.

    (I say "with fontconfig", but it actually consists of three parts: fontconfig, which keeps a database of fonts; freetype, which renders them; and xft, which connects it all with X.)

    Now defoma. Defoma is something Debian specific. It's used by Debian font packages to register themselves with every font-using thing installed. As you look at the list of limitations of X core fonts, you can imagine quite a lot of programs have grown their own font systems. I don't think anybody really understands how defoma works, and you can safely ignore it.

    To get a bit more concrete: you have successfully configured the X core fonts system to use your font, and discoverd pretty much nothing uses it anymore :)

    To install a font, the modern Linux way, drop it in the ~/.fonts directory (create the directory if it doesn't exist yet). Or, alternatively, add the directory where you put the font to /etc/fonts/local.xml.

    BTW, I think Windows .fon files are supported, so you don't even need to convert them.

    1. Re:Ok, this is what I know by koreth · · Score: 3, Informative
      Thanks for the informative message! That helps clarify things. Putting fonts in my ~/.fonts directory does seem like it works more often than not, but not 100% of the time. The example I linked to in the article is one of the failures. I've put it in my ~/.fonts directory (as well as in a couple of system fonts directories listed in the /etc/fonts config files) in PCF and BDF and FON formats and nothing seems to notice it. If it weren't for the fact that it works in xterm I would have just assumed the font file was corrupt in some way. (Which maybe it is, in some way that xterm doesn't mind.)

      My reason for posting the article is less about getting this particular font installed than about understanding why it's not working, of course. Are you aware of any diagnostics I can look at that might shed light on the matter?

    2. Re:Ok, this is what I know by reynaert · · Score: 4, Informative
      Heh, I completely forgot about your font :)

      Fontconfig recognized the sheldon4.fon file, but when I tried to use the font, it just showed blank space -- no letters, not even substitutions from another font. I tried to convert it using FontForge and produced a variety of non-working versions. Eventually I found the key is to change the encoding in the Font Info dialog to Unicode, with that I created this working version. (This is the first time I've used FontForge, so I might have been doing stupid things.)

      I guess this mess shows people just don't care for bitmap fonts anymore :) BDF/PCF is pretty much deprecated and it's not really a surprise Windows-specific formats like .FON are poorly supported. (Bitmap-only TrueType fonts should still work fine, however.)

      As for diagnostics, the only thing I know about is fc-list, which is fontconfig's version of xlsfonts. You could try asking the fontconfig mailing list, it seems to be the most likely place to reach people who know more.

    3. Re:Ok, this is what I know by Sepper · · Score: 2, Informative

      Then check don't out http://elektra.sourceforge.net/
      it's basicly the monstrosities you are talking about. (as-in-changing every file in /etc to an XML database format)

      --
      I live in Soviet Canuckistan you insensitive clod!
  4. I don't need a subject, thanx by trevorcor · · Score: 3, Informative

    dpkg-reconfigure fontconfig, and choose "yes" when asked about bitmapped fonts.

    It's a good idea to install the x-ttcidfont.conf (or whatever it's called) package and follow the directions in /usr/share/doc/x-ttcidfont-conf/README.Debian.

    Other than that, I recommend you don't try to understand the font mechanisms, but just try to forget they're there; it's easier that way.

    --
    "That's all I have to say about that" --Forrest Gump
  5. Dots Per Inch... by netsharc · · Score: 4, Informative
    Another problem I've noticed, the font size can suddenly change depending what window manager - KDE vs Gnome I was using. When I start a KDE program in Gnome, the fonts would get bigger. Looking at the Control Center, it still says 10 points, but the problem was Gnome and KDE had differing DPI settings. One way to fix this is to specify
    DisplaySize 400 300
    in the monitor section of xorg.conf so that the DPI can be properly determined. The sizes (in millimeters) doesn't have to be your monitor size, I preferred to have a round, square DPI number (96x96 DPI) than an actual calculation of how many DPI my monitor really has, because I think the font server does some funny calculation using them, and it'll probably be distorting if they're not square (though I'm not really sure).

    For a resolution of 1280x960, aiming for 96 DPI gets you 25.4*1280/96 = 339 mm and 25.4*960/96 = 254 mm (gee, that was a hard equation! :p), which are pretty close numbers to the real screen size of monitor advertised as 19".

    To see your current DPI settings, open an xterm and type "xdpyinfo|grep inch" (or is it "Inch"?)
    --
    What time is it/will be over there? Check with my iPhone app!
  6. Re:Read down the page of the font you linked to. f by koreth · · Score: 2, Informative
    You mean the one that tells me to go download the updated, converted version of ProFont and install it? Great advice, or it would be if ProFont were the font I wanted to install, which it isn't. Sadly, there is no such modified version of the Sheldon font I prefer, so that thread (which I'd already read, thanks) is of no use to me other than mentioning that there's "some kind of encoding messup."

    And in any event even if there were a version of the right font, that wouldn't help me know what to do the next time I came across a font that didn't work. Which is really the larger point of the posting here.

  7. Xorg's documentation by Wolfbone · · Score: 3, Informative
  8. Answer: Use KDE by metamatic · · Score: 3, Informative

    Use KDE's font installer to install and manage fonts, it just works. Handles TrueType and Type 1 fonts, just drag and drop to install.

    There's TeX and LaTeX and METAFONT... but for those, I suggest you use pdftex and pdflatex and use Type 1 fonts, rather than going through the whole "building multiple sizes of METAFONT-rendered bitmaps" thing. Ideally, use the native PDF fonts to keep your PDFs down in size.

    There are also various old bitmap X fonts hanging around on my system. I don't deliberately use any of them, but I leave 'em there in case there are applications I need that don't handle scaleable TTF/Type1 yet.

    --
    GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
  9. Re:The story of a keypress become a pixel by Anonymous Coward · · Score: 1, Informative

    I recommend you read the Unix Haters Handbook. It partly explains the mess that you seem to be curious about.

    Read the chapters "Terminal Insanity" and "The X-Windows Disaster", although they doesn't really discuss fonts much, they give some insight into the *cough* design *cough* of Unix, and hopefully make you give up on your story idea like it did to me.