"The Linux Gazette...making Linux just a little more fun!"


(?) The Answer Guy (!)


By James T. Dennis, tag@lists.linuxgazette.net
LinuxCare, https://www.linuxcare.com/


(?) Adding Fonts

From Swami Atmarupananda on Wed, 22 Sep 1999

I've got a long shelf of linux books, and none of them say anything about how to add fonts. They all tell you in great detail what fonts are on the system, but not how to add them. I'm using S.u.S.E. 6.1 (shortly to upgrade to 6.2), but have used RedHat also (5.2 and 6.0).

I understand that TrueType support is not yet built into the kernel (can be used with limited success in Star Office 5.1), but perhaps soon will be. But going with the present font support, how can one add fonts?

Thanks.
Swami Ananda

(!) I assume you're talking about adding display fonts to your X system.

[ It's worth noting that in Linux terms, X is not the kernel. The console driver isn't going to support TrueType, although it can be convinced to use special raster fonts, and if I recall correctly SuSE actually makes it quite easy to set those (use YaST). -- Heather ]

I've never added any X fonts to any of my Linux boxes. As many of my long time readers know I mostly work with servers and text. However, Heather, my lovely wife (and assistant LG TAG editor) does use X quite a bit more.
From what she says you should be able to just add your new fonds (BDF or Type 1) into any of one the directories that's listed in your XF86Config file's FontPath. Edit the config file, look for the "files" section and you should see the list of FontPath entries. Alternatively you can put your new fonts in a new directory (/usr/local/X11/fonts, maybe) and add that to your FontPath.
After that you MUST RUN the 'mkfontdir' command to generate the .../fonts.dir files in each of these directories. Read the 'mkfontdir' man page for more details on that.

[ The mkfontdir is really important because the resulting text files help tell X how to internally map between a font name you and I might consider normal (for example, "fixed"), the file name (6x13.pcf.gz), and the much longer font designator created by X applications (ex: "-misc-fixed-medium-r-normal-*-15-*-75-75-c-90-iso8859-1"). It's certainly possible to create the entries yourself, by hand, and I generally do, just to improve my understanding. The important thing is to look at the files that should already be there. And of course, it won't take effect until your font server gets restarted. -- Heather ]

Other subsystems have their own font handling.
For example you can add fonts to the LaTeX (teTeX) system using their 'fontimport' script (read its man pages, the teTeX.FAQ, and or browse Thomas Esser's web pages at: https://tug.org/teTeX). teTeX is a distribution of the TeX/LaTeX typesetting system. LaTeX is a set of TeX macros, style sheets and document class definitions and TeX is a Donald Knuth's typesetting language: a programming language for describing typeset pages (and typeset pages of technical information, mathematical formulae in particular).
There is another text driven typesetting package on a typical Linux system called 'roff' (which is actually 'groff' the GNU 'roff' suite). 'roff' is short for 'runoff' (apparently an old typesetting term). Your man pages are in *roff format, and there are pakages like 'tbl' (table typesetter) and 'pic' (picture typesetting language), and 'eqn' (for equations and formulae). You can add fonts to the 'groff' subsystem using commands like 'afmtodit' and 'tfmtodit'.
Of course your printing subsystem might have many fonts of its own. For example you might be using GhostScript (gs) to render PostScript into your printer's native page description language (PDL). GhostScript allows you to make many printers emulate a PostScript printer. This allows you to transparently use applications that only know how to generate plain text or PostScript (many) without paying for a PostScript printer.
Generally you print LaTeX files using 'dvips' (.dvi, or "DeVice Independent," is the intermediate or "object" file output of TeX and LaTeX), or 'grops' (the 'groff' to PostScript) tool to print TeX and/or *roff files. However, there are many utilities (dviware) that can directly drive many printers in their own native PDL.
As for TrueType support. You are correct. The current releases of XFree86 don't include support for TrueType. However, they do point out a number of alternative solutions in their FAQ at https://www.xfree86.org (where most people with questions about X under Linux should go instead of me!)
They mention that they are planning to incorporate TrueType support into the next major release (presumably that will be 4.0). Meanwhile individual programs can implement their own TrueType or other independent font support as needed. It's a shame for them to do that, as the windowing system should provide it in one place rather than having each client do it separately. However it can be done.

[ On my primary graphics workstation (betelgeuse, our VARstation II) I run a copy of xfs (the X external font server) that understands TrueType as well as the usual run of fonts. Running font services externally means canopus, deneb, and if I was really crazy antares, can all share all these TTFs that I took the effort to set up. It was part of a binary package available for xfstt, which I found when I read an LG article about some other app trying to provide TrueType support.

Anyways, with this, I can use TTF's in the GIMP very easily. I now have too many fonts to view them effectively in xfontsel, but I don't care. It is frustrating that Netscape won't properly scale TrueType fonts for me, but that appears to be Netscape's problem, not mine. -- Heather ]

I gather that the GTK canvas has some support for PostScript fonts (GTK is the GIMP Toolkit, a set of programming libraries originally written for the GIMP, GNU Image Manipulation Program, and used as the display technology for GNOME). Perhaps they'll add TrueType to that, and/or to DGS (Display GhostScript, part of the GNUStep project) before XFree86 4.x ships.
As you can see, fonts are a complex issue. However, you probably were mainly interested in just displaying them, and possibly adding printer support. I suspect you aren't using LaTeX or 'groff' typesetting.
The 'gs' (GhostScript) installation often gets installed with your distribution and just works without much further thought. However, I don't know if you can find a .ttf to .afm conversion tool. It would probably need that to get printing to work.
Hello! Here's a link:
The (preliminary) TrueType HOWTO
https://www.moisty.org/linux/TrueType-HOWTO.html
Look at questions 3.1 and 3.2!
Often I don't find the best FAQs in my web searches until I've written most of my message for LG. That's because I write "off the cuff" and do the research (usually in 'lynx', in another 'screen' window as I type).
It looks like newer versions of GhostScript can be compiled to support TrueType fonts. I guess that would have been in your 'gs' man pages if you had the new version.
I've copied Brion Vibber, the author of this (prelimary) HOWTO to encourage him to submit that HOWTO to the LDP as soon as possible. (Brion, don't worry if it's done! It's info we want to see in the LDP tree NOW!).
I hope all of that helps.


Copyright © 1999, James T. Dennis
Published in The Linux Gazette Issue 46 October 1999
HTML transformation by Heather Stern of Starshine Technical Services, https://www.starshine.org/


[ Answer Guy Current Index ] 1 2 3 5 5 6
7 8 9 10 11 12 [ Index of Past Answers ]


[ Table Of Contents ] [ Front Page ] [ Previous Section ] [ Linux Gazette FAQ ] [ Next Section ]