  This file documents the Kpathsearch library.

  Copyright (C) 1993, 94 Karl Berry.

  Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.

  Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided also that the
section entitled "Freedom" and "GNU General Public License" are
included exactly as in the original, and provided that the entire
resulting derived work is distributed under the terms of a permission
notice identical to this one.

  Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that the sections entitled "Freedom" and "GNU General
Public License" may be included in a translation approved by the Free
Software Foundation instead of in the original English.

Kpathsearch library
*******************

  This manual documents how to install and use the Kpathsearch library
for filename lookup.  It corresponds to version 1.6 (released in
February 1994).

Introduction
************

  This manual corresponds to version 1.6 of the Kpathsearch library,
released in February 1994.

  The library's fundamental purpose is to look up a file in a list of
directories specified by the user.

  The following software, all of which I maintain, uses this library:

   * web2c

   * Xdvik

   * Dvipsk (see Introduction (dvipsk))

   * GNU font utilities (see Introduction (fontu))

  The library is still under development. I do not promise to keep the
interface unchanged.  If you have comments or suggestions, please send
them to me (see Bugs. for the address).

  Currently, I distribute the library under the GNU General Public
License (see Copying.).  In summary, this means if you write a
program using the library, you must (offer to) distribute the source,
and allow anyone to modify the source and distribute their
modifications.

  If you have a problem with this, please contact me. I would consider
putting the library under the GNU Library General Public License, which
would permit you to distribute the source only to the library, not the
your program using it.  But I will only do this if someone actually says
they will not use the library under the GPL conditions, and would use it
under the LGPL.

  This manual contains a few references to the C source for the library;
they're there to help programmers reconcile my statements in this
documentation with the Awful Truth of the code.  If you're not a
programmer, just ignore them.

Installation
************

  Here are the basic steps for configuration and installation:

  1. `configure'.  This automatically determines most system
     dependencies.

  2. If necessary, edit the definitions in `Makefile' or `c-auto.h'.
     See System dependencies, below, for additional definitions you
     may need to make.

  3. `make'.

  4. `make install'. This installs the library, header files, and
     documentation.

  5. `make distclean'.  This removes all files created by the build.

  Since I only distribute Kpathsea as part of another package, you will
probably be doing the above in a top-level directory that contains a
`Makefile', `kpathsea', and the other package.  But you can do the
installation in `kpathsea' itself, if you only want to install the
library, not the other package.

System dependencies
===================

  Although `configure' can reliably determine most aspects of your
system, there are a few things it does not do.

Default paths
-------------

  The directories into which files are installed are defined in the
top-level `Makefile'. The default paths which programs use to search
for inputs are defined in `kpathsea/paths.h'.  You will almost
certainly want to change either or both of these to match your
preferred local directory structure.

  Both of these files are automatically created: the `Makefile' at
`configure' time, `kpathsea/paths.h' at compile time. Thus, to change
the default paths, the simplest thing to do is edit the template files
`Makefile.in' and `paths.h.in' before running `configure'.

  The Make definitions are all repeated in several `Makefile''s; but
changing the top-level `Makefile' should suffice, as it passes down all
the variable definitions, thus overriding the submakes. (The
definitions are repeated so people can potentially run Make in the
subdirectories.)

  The file `kpathsea/HIER' has some explanation of the default setup.

  A caveat: If you put `$HOME' or `~' in any of the paths, do not
search that component recursively: when you run as root, you might wind
up searching (say) `/zoneinfo/Brazil/tex/macros'. And of course it will
take quite some time to look at every directory on the system.

`wchar_t'
---------

  The upshot of all the following is that if you get error messages
regarding `wchar_t', try defining `NO_FOIL_X_WCHAR_T'. This is reported
to be necessary on Linux.

  `wchar_t' has caused infinite trouble. None of my code ever uses
`wchar_t'; all I want to do is include X header files and various
system header files, compiling with GCC. This seems an impossible task.

  The X11R5 `<Xlib.h>' and GCC's `<stddef.h>' have conflicting
definitions for wchar_t.

  The particulars: `<X11/Xlib.h>' from MIT X11R5 defines `wchar_t' if
`X_WCHAR' is defined, which is defined if `X_NOT_STDC_ENV' is defined,
and we define *that* if `STDC_HEADERS' is not defined (`configure'
decides if STDC_HEADERS gets defined).  But when compiling with gcc on
SunOS 4.1.x, `STDC_HEADERS' is not defined (`string.h' doesn't declare
the `mem'* functions), so we do get X's `wchar_t'--and we also get
gcc's `wchar_t' from its `<stddef.h>'.  Result: conflicting definitions.

  On the other hand, SunOS 4.1.1 with some other X configurations
actually needs GCC to define `wchar_t', and fails otherwise.

  My current theory is to define `wchar_t' to a nonsense symbol before
the X include files are read; that way its definition (if any) will be
ignored by other system include files.  Going along with that, define
`X_WCHAR' to tell X not to use `<stddef.h>', that we've already
included, but instead to make its own definition.

  But this is not the end of the story. The X11 include files
distributed with DG/UX 5.4.2 for the Aviion have been modified to
include `<_int_wchar_t.h>' if `X_WCHAR', so our `#define' will not have
any typedef to change--but the uses of `wchar_t' in the X include files
will be changed to reference this undefined symbol. So there's nothing
to foil in this case; I don't know how to detect this automatically, so
it's up to you to define `NO_FOIL_X_WCHAR_T' yourself.

`putenv'
--------

  If you are on a Net2/BSD or other system which has a `putenv' that
knows how to avoid garbage when the same environment variable is set
many times, define `SMART_PUTENV'. (And if you can write a test for
this that could be incorporated into the `configure' script, please
send it to the address given in Bugs.)

The `configure' script
======================

  (This section is largely from the Autoconf manual, by David MacKenzie.
See Running `configure' scripts (autoconf).)

  The `configure' script that comes with this distribution was
generated by the Autoconf program.  Thus, you can regenerate
`configure' by rerunning Autoconf.  You might want to do this if a new
version of Autoconf is released, for example.

  The purpose of `configure' is to adapt the present source to the
particulars of your system.  For example, the name of the directory
header file (`dirent.h' or `sys/dir.h'), whether the GNU C compiler
`gcc' is available, and so on.

  Normally, you do not need to give any options to `configure'; just
`cd' to the directory with the source code and type `configure'.
Exceptions: if `.' is not in your `PATH', you must type `./configure';
if you are using a non-Bourne compatible shell on systems that do not
support `#!', you must type `sh configure'.

  Running `configure' takes a minute or two.  While it is running, it
prints some messages that tell what it is doing.  If you don't want to
see the messages, run `configure' with its standard output redirected
to `/dev/null'; e.g., `configure >/dev/null'.  On the other hand, if
you want to see even more messages, give `configure' the `-v' option.

  To compile the package in a different directory from the one
containing the source code, you must use a variant of Make that
supports the `VPATH' variable, such as GNU Make.  `cd' to the directory
where you want the object files and executables to go and run
`configure' with the option `--srcdir=DIR', where DIR is the directory
that contains the source code.  Using this option is unnecessary if the
source code is in the parent directory of the one in which you are
compiling; `configure' automatically checks for the source code in `..'
if it does not find it in `.'.

  `configure' (in the top-level directory) guesses the default
installation prefix (we'll call it `$(prefix)', which is the
corresponding Make variable) by looking for a directory which contains
an executable named `tex', and using its parent.  In the package
subdirectories, such as `kpathsea', `configure' doesn't try to guess
the prefix (to avoid a conflict with the guess made at the top level);
the default `/usr/local' is left.

  You can override this default guess for the installation prefix by
giving `configure' the option `--prefix=PATH'.  You can also specify
separate installation prefixes for architecture-specific files and
architecture-independent files by giving `configure' the option
`--exec-prefix=XPATH' (which substitutes for the Make variable
`$(exec_prefix)').  Then XPATH will be the prefix for installing
programs and libraries.  Data files and documentation will still use
`$(prefix)'.

  You can tell `configure' to figure out the configuration for your
system, and record it in a file `config.status', without actually
configuring the package.  To do this, give `configure' the
`--no-create' option.  Later, you can run `./config.status' to actually
configure the package.  This option is useful mainly in `Makefile'
rules for updating `config.status' and the `Makefile' itself.  You can
also give `config.status' the `--recheck' option, which makes it rerun
`configure' with the same arguments you used before.  This is useful if
you change `configure'.

  `configure' ignores any other arguments that you give it.

  On systems that require unusual options for compilation or linking
that the package's `configure' script does not know about, you can give
`configure' initial values for variables by setting them in the
environment.  In Bourne-compatible shells, you can do that on the
command line like this:

     CC='gcc -traditional' LIBS=-lposix sh configure

  The Make variables that you might want to override with environment
variables when running `configure' are:

  (For these variables, any value given in the environment overrides the
value that `configure' would choose.)

`CC'
     The C compiler program.  The default is `gcc' if that is in your
     `PATH', `cc' otherwise.

`INSTALL'
     The program to use to install files.  The default is `install' if
     you have it, `cp' otherwise.

  (For these variables, any value given in the environment is added to
the value that `configure' chooses.)

`DEFS'
     Configuration options, in the form `-Dfoo -Dbar...'.

`LIBS'
     Libraries to link with, in the form `-lfoo -lbar...'.

  Of course, problems requiring manual intervention (e.g., setting these
variables) should ideally be fixed by updating either the Autoconf
macros or the `configure.in' file for that package.

Reporting bugs
==============

  If you encounter problems, report them to `tex-k@cs.umb.edu'.
Include the version number of the library, the system you are using, and
enough information to reproduce the bug in your report.  To get on this
mailing list yourself, email `tex-k-request@cs.umb.edu' with a message
whose body contains a line
     subscribe YOUR-PREFERRED-EMAIL-ADDRESS

  To avoid wasted effort and time (both mine and yours), I strongly
advise applying the principles given in the GNU C manual (see
Reporting Bugs (gcc)) to your bug reports for any software.

  Please also report bugs in this documentation--not only factual
errors, but unclear explanations, typos, wrong fonts, ....

  When compiling with old C compilers, you may get some warnings about
"illegal pointer combinations".  These are spurious; ignore them.  I do
not want to clutter up the source with casts to get rid of them.  In
general, if you have trouble with a system C compiler, I advise trying
the GNU C compiler.

Path specifications
*******************

  This chapter describes the user interface of the path specifications
that the Kpathsearch library implements.

  Conceptually, there are two distinct stages: generating a list of
directories in which to search, and then looking up files using that
list.  The sections below describe each of these in turn.

  In the implementation, however, these stages are
interleaved--directory lists are only generated as needed for a
particular file lookup, then they are cached for future lookups.
(Analogous to lazy evaluation in programming languages.)  This implies
that directories that are created *during* the run are not seen.

Directory list generation
=========================

  Kpathsearch constructs a directory list from an environment variable
VAR set by the user, (possibly) a setting from a configuration file,
and a default path set at compile time.  Each of these are
colon-separated lists of directories.  If VAR is set, its value is
used; otherwise, if a config file defines a value, that value is used;
otherwise, the compilation default is used.  In any case, once the path
specification to use is determined, its evaluation is independent of its
source.

  The "colon" and "slash" mentioned below aren't necessarily `:' and
`/' on non-Unix systems; the library tries to adapt these characters to
other operating systems' conventions.

  The following subdirectories explain the various kinds of "expansion"
the path is subjected to.  After expansion, nonexistent directories in
the path is ignored.

Default expansion
-----------------

  If an environment variable or config file value has a leading or
trailing or doubled colon, the default path is inserted at that point.

  Putting an extra colon into the default value has unpredictable
results, and may cause the program to crash, so installers beware.

Tilde expansion
---------------

  A leading `~' or `~USER' in a path component is replaced by the
current or USER's home directory, respectively.

  If USER is invalid, or the home directory cannot be determined,
Kpathsea uses `.' instead.

Variable expansion
------------------

  A construct `$foo' or `${foo}' is replaced by the expansion of the
environment variable `foo'.  In the first case, the variable name
consists of consecutive alphanumeric-or-underscore characters.  In the
second, the variable name consists of everything between the braces.

  Remember to quote the `$''s and braces as necessary for your shell.

  *Shell* variable values cannot be seen by Kpathsea.

Subdirectory expansion
----------------------

  If a component directory D contains `//', all subdirectories of D are
included in the path: first those subdirectories directly under D, then
the subsubdirectories under those, and so on.  At each level, the order
in which the directories are searched is unspecified.

  If you specify any filename components after the `//', only
subdirectories which have those components are included.  For example,
`/a//b' would expand into directories `/a/1/b', `/a/2/b', `/a/1/1/b',
and so on, but not `/a/b/c' or `/a/1'.

Subdirectory problems
.....................

  Perhaps the first problem is best put as a question-and-answer.

  Question: I know all about slow starting TeX `:-)'.  How do I
organize the directory scheme to avoid the slowness, while at the same
time enjoying a structured inputs directory?

  (Naturally, this applies to any Kpathsea-using program, not just TeX.)

  I will give the false Short Answer first, then the Real Explanation.

  The Short Answer: in your equivalent of `/usr/local/lib/tex/macros//'
and `.../fonts//', make each subdirectory contain either 1) only
directories; or 2) only files.

  As long as you do not have (literally) hundreds of subdirectories,
this should cure the problem.  It has in every case I have been told
about.

  The Real Explanation: the thing that makes TeX slow is calling `stat'
(if you don't know what `stat' (2) is, ignore this explanation) on "too
many" pathnames, where "too many" is some nebulous number depending on
things like whether the filesystem is NFS-mounted or not, whether it's
on a fast disk, whether your Fast File System implementation is really
Fast, etc., etc.

  (Side note: If you're curious, you can find this number by writing a
program that does nothing but read filenames (presumably from a file)
and stat them, and see how many pathnames make the execution time
noticeable.  On the systems I use (Suns with an NFS-mounted directory,
ISC 2.2.1 and a local directory), it's several hundred, at least.  On an
NFS-mounted mounted directory under Solaris 2.1, 150 is quite slow,
according to `hammer@kis.uni-freiburg.de'.)

  Whether or not it's directories or files that are being stat-ed is
irrelevant (this is why the Short Answer is false).  It's sheer numbers
that count.

  If you think your directory structure is ok, and you're still
experiencing slowness, I advise running TeX (or whatever program) under
a debugger, setting the bit `DEBUG_STAT' in the variable
`kpathsea_debug' (see `debug.h') to one and seeing exactly what is
getting stat-ed.  If only a few things are getting stat-ed, and TeX is
still slow, tell me.

  I should also mention "the trick", which I stole from GNU find.
(Matthew Farwell `<dylan@ibmpcug.co.uk>' suggested it, and David
MacKenzie `<djm@gnu.ai.mit.edu>' implemented it, I believe.)

  The trick is that in every real Unix implementation (that I know
about) (as opposed to the POSIX specification), a directory which
contains no subdirectories will have exactly two links (specifically,
one each for `.' and `..').  That is to say, the `st_nlink' field in
the stat structure will be two.  Thus, the path searching code doesn't
have to stat every entry in the bottom-level directories--it can check
`st_nlink', and if it's two, it knows there are no subdirectories.

  But if you have a directory that contains *one* subdirectory and five
hundred files, st_nlink will be 3, and Kpathsea has to stat every one
of those 501 entries.  Therein lies slowness.

  You can disable the trick by undefining UNIX_ST_LINK in
`kpathsea/config.h'.

  The subdirectory searching has one other known (and irreconciliable)
deficiency.  If a directory D being searched for subdirectories
contains plain files and symbolic links to other directories, but no
true subdirectories, D will be considered a leaf directory, i.e., the
symbolic links will not be followed.

  The directory immediately followed by the `//', however, is always
searched for subdirectories, even if it is a "leaf".  We do this since
presumably you would not have asked for the directory to be searched
for subdirectories if you didn't want it to be.

  This is a consequence of the trick explained above.  You can work
around this problem by simply creating an empty dummy subdirectory in D;
then D will no longer be a leaf, and the symlinks will be followed.

Path specification example
--------------------------

  For example, the following value for an environment variable says to
search the following: the current user's `fonts' directory and alll its
subdirectories, then the directory `fonts' in user `karl's home
directory, and finally the system default directories specified at
compilation time.

     ~/fonts//:~karl/fonts:

File lookups
============

  Given the directory list generated from the rules in the previous
section, looking up a file presents no problem at all: we just look in
each directory in the list in turn, and return the first one found.

  The only complication is if the filename is absolute or explicitly
relative, i.e., (under Unix-like operating systems) starts with `/' or
`./' or `../'.  Then the library does not use the directory list at
all.  Instead, the file is simply searched for in the given directory.

TeX support
***********

  Although the basic features in Kpathsea can be used for any type of
path searching, I wrote Kpathsea specifically for TeX system programs.
I had been struggling with the programs I was using (Dvips, Xdvi, and
TeX itself) having slightly different notions of how to specify paths;
and debugging was painful, since no code was shared.

  Therefore, Kpathsea provides some TeX-specific features.  Indeed,
many of the supposedly generic path searching features were provided
because it seemed useful in conTeXt, particularly for font lookup.

TeX environment variables
=========================

  Kpathsea defines a sequence of environment variables to search for
each type of TeX file.  This makes it easy for different programs to
check the same environment variables, in the same order.

  The following table lists the environment variables searched for each
file type in the order they are searched (and a brief description of the
file type).  That is, only if the first variable is unset is the second
variable checked, and so on.  If none are set, a default set at
compilation time is used.

`.base'
     (Metafont memory dump) `MFBASES'

`.bib'
     (BibTeX source) `BIBINPUTS'

`.bst'
     (BibTeX style file) `BSTINPUTS', `TEXINPUTS'

`.fmt'
     (TeX memory dump) `TEXFORMATS'

`gf'
     (generic font bitmap) `GFFONTS', `GLYPHFONTS', `TEXFONTS'

`.mf'
     (Metafont source) `MFINPUTS'

`mf.pool'
     (Metafont program strings) `MFPOOL'

`pk'
     (packed bitmap font) `PKFONTS', `TEXPKS', `GLYPHFONTS', `TEXFONTS'

`.tex'
     (TeX source) `TEXINPUTS'

`tex.pool'
     (TeX program strings) `TEXPOOL'

`.tfm'
     (TeX font metrics) `TFMFONTS', `TEXFONTS'

`.vf'
     (virtual font) `VFFONTS', `TEXFONTS'

These lists are defined in the source file `kpathsea/filefmt.h'.

  For the font variables, the intent is that:

  1. `TEXFONTS' is the default for everything.

  2. `GLYPHFONTS' the default for bitmap (or, more precisely,
     non-metric) files.

  3. Each format has its own variable.

  4. Not shown in the table is that each program can and should have
     its own path as well--`XDVIFONTS' and `DVIPSFONTS' in the case of
     Xdvik and Dvipsk.

Glyph lookup
============

  Kpathsea provides a routine (`kpse_find_glyph_format' in
`kpathsea/tex-glyph.c') which searches for a bitmap font in GF or PK
format (or either) given a font name (e.g., `cmr10') and a resolution
(e.g., 300).

  The search is based solely on filenames, not file contents--if a PK
file is named `cmr10.300gf', it will be found as a GF file.

  Here is an outline of the search strategy (details in the sections
below) for a file NAME at resolution DPI.  The search stops at the
first successful lookup.

  1. Look for an existing file NAME.DPI in the specified formats.

  2. If NAME is an alias for a file A in some "fontmap" file, look for
     A.DPI.

  3. Run an external script (typically named `MakeTeXPK') to generate
     the font.

  4. Look for FALLBACK.DPI, where FALLBACK is some last-resort font
     (typically `cmr10').

Basic glyph lookup
------------------

  When Kpathsea looks for a bitmap font NAME at resolution DPI in a
format FORMAT, it first checks if a file `NAME.DPIFORMAT' exists; for
example, `cmr10.300pk'.  Kpathsea looks for a PK file first, then a GF
file.

  If that fails, Kpathsea looks for a font with a close-enough DPI.
"Close enough" is defined (by the macro `KPSE_BITMAP_TOLERANCE' in
`kpathsea/tex-glyph.h') to be `DPI / 500 + 1', which is slightly more
than the 0.2% allowed by the DVI standard.

  The filename is not hardwired to `NAME.DPIFORMAT'; you can change it
by setting the environment variable `KPATHSEA_BITMAP_NAME' to a
different specification.  The default spec is

     $KPATHSEA_NAME.$KPATHSEA_DPI$KPATHSEA_FORMAT

Kpathsea sets these environment variables as it runs, as appropriate
for each lookup.  You can use any environment variables you like, not
just these, in the spec.

Fontmap
-------

  If a bitmap font is not found, Kpathsea looks through any "fontmap"
files for an "alias" for the original font name.  I implemented this
for two reasons:

  1. An alias name is limited in length only by your available memory,
     not by whatever bizarre limitations your filesystem might impose.
     Therefore, if you want to ask for
     `Adobe-Lucida-Bold-Sans=Typewriter--10' instead of `plcbst10', you
     can.

  2. A few fonts have historically had multiple names: specifically,
     LaTeX's "circle font" has variously been known as `circle10',
     `lcircle10', and `lcirc10'.  Aliases can make all the names
     equivalent, so that it no longer matters what the name of the
     installed file is; TeX documents will find their favorite name.

  The format of fontmap files that implement these ideas is
straightforward: the first word on each line is the true filename; the
second word is the alias; subsequent words are ignored.  A "word" is
just a sequence of non-whitespace characters.  Blank lines are ignored;
comments start with `%' and continue to end-of-line.

  If an alias has an extension, it matches only those files with that
extension; otherwise, it matches anything with the same root,
regardless of extension.  For example, an alias `foo.tfm' matches only
when exactly `foo.tfm' is being searched for; but an alias `foo'
matches `foo.vf', `foo.300pk', or whatever.

  As an example, here are the fontmap entries that make the circle fonts
equivalent:

     circle10	lcircle10
     circle10	lcirc10
     lcircle10	circle10
     lcircle10	lcirc10
     lcirc10		circle10
     lcirc10		lcircle10

`MakeTeX'... scripts
--------------------

  If Kpathsea cannot find a bitmap font, by either its original name or
a fontmap alias, it can be configured to invoke an external program to
create it.  The same mechanism can be used for other nonexistent files.

  The script is passed the name of the file to create and possibly other
arguments, as explained below.  It must echo the full pathname of the
file it created (and nothing else) to standard output; it can write
diagnostics to standard error.

`MakeTeX'... script names
.........................

  The following table shows the default name of the script for each
possible file types.  (The source is the variable `kpse_make_specs' in
`kpathsea/tex-make.c'.)

`MakeTeXPK'
     Glyph fonts.

`MakeTeXTeX'
     TeX input files.

`MakeTeXMF'
     Metafont input files.

`MakeTeXTFM'
     TFM files.

These names are overridden by an environment variable specific to the
program--`DVIPSMAKEPK' and `XDVIMAKEPK', in the case of Dvipsk and
Xdvik.

`MakeTeX'... script arguments
.............................

  The first argument to a `MakeTeX'... script is always the name of the
file to be created.  In the case of `MakeTeXPK', there are three or
four additional arguments passed, via corresponding environment
variables:

  1. The dpi to make the font at (`KPATHSEA_DPI').

  2. The "base dpi" the program is operating at (`MAKETEX_BASE_DPI').

  3. A "magstep" string suitable for assigning to the Metafont `mag'
     variable (`MAKETEX_MAG').

  4. Possibly, a Metafont mode name for assigning to the Metafont `mode'
     variable (`MAKETEX_MODE').

Kpathsea sets `KPATHSEA_DPI' appropriately for each font.  It's up to
the program using Kpathsea to set the others.

  You can change the specification for the arguments passed to the
external script by setting the environment variable named as the script
name, but all capitals--`MAKETEXPK', for example.  If you've changed
the script name by setting (say) `DVIPSMAKEPK' to `foo', then the spec
is taken from the environment variable `FOO'.

  The spec can contain any variable references, to the above variables
or any others you might have set.  As an example, the default spec for
`MakeTeXPK' is

     $KPATHSEA_DPI $MAKETEX_BASE_DPI $MAKETEX_MAG $MAKETEX_MODE

The name of the file to be created being passed as the first argument
cannot be changed.

Fallback font
-------------

  If a bitmap font cannot be found or created at the requested size,
Kpathsea looks for the font at a set of "fallback resolutions".  You
specify these resolutions as a colon-separated list (like search paths).
Kpathsea looks first for a program-specific environment variable
(`DVIPSSIZES' and `XDVISIZES', in the case of Dvipsk and Xdvik), then
the environment variable `TEXSIZES', then a default specified at
compilation time (the Make variable `default_texsizes').  You can set
this list to be empty if you prefer to find fonts at their stated size
or not at all.

  Finally, if the font cannot be found even at the fallback resolutions,
Kpathsea looks for a fallback font, typically `cmr10'.  Programs must
enable this feature by assigning to the global variable
`kpse_fallback_font'; the default is no such fallback font.

GNU GENERAL PUBLIC LICENSE
**************************

                         Version 2, June 1991

     Copyright (C) 1989, 1991 Free Software Foundation, Inc.
     675 Mass Ave, Cambridge, MA 02139, USA

     Everyone is permitted to copy and distribute verbatim copies
     of this license document, but changing it is not allowed.

Preamble
========

  The licenses for most software are designed to take away your freedom
to share and change it.  By contrast, the GNU General Public License is
intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it.  (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.)  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it in
new free programs; and that you know you can do these things.

  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  You must make sure that they, too, receive or can get the
source code.  And you must show them these terms so they know their
rights.

  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

  Finally, any free program is threatened constantly by software
patents.  We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary.  To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.

  The precise terms and conditions for copying, distribution and
modification follow.

    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  1. This License applies to any program or other work which contains a
     notice placed by the copyright holder saying it may be distributed
     under the terms of this General Public License.  The "Program",
     below, refers to any such program or work, and a "work based on
     the Program" means either the Program or any derivative work under
     copyright law: that is to say, a work containing the Program or a
     portion of it, either verbatim or with modifications and/or
     translated into another language.  (Hereinafter, translation is
     included without limitation in the term "modification".)  Each
     licensee is addressed as "you".

     Activities other than copying, distribution and modification are
     not covered by this License; they are outside its scope.  The act
     of running the Program is not restricted, and the output from the
     Program is covered only if its contents constitute a work based on
     the Program (independent of having been made by running the
     Program).  Whether that is true depends on what the Program does.

  2. You may copy and distribute verbatim copies of the Program's
     source code as you receive it, in any medium, provided that you
     conspicuously and appropriately publish on each copy an appropriate
     copyright notice and disclaimer of warranty; keep intact all the
     notices that refer to this License and to the absence of any
     warranty; and give any other recipients of the Program a copy of
     this License along with the Program.

     You may charge a fee for the physical act of transferring a copy,
     and you may at your option offer warranty protection in exchange
     for a fee.

  3. You may modify your copy or copies of the Program or any portion
     of it, thus forming a work based on the Program, and copy and
     distribute such modifications or work under the terms of Section 1
     above, provided that you also meet all of these conditions:

       a. You must cause the modified files to carry prominent notices
          stating that you changed the files and the date of any change.

       b. You must cause any work that you distribute or publish, that
          in whole or in part contains or is derived from the Program
          or any part thereof, to be licensed as a whole at no charge
          to all third parties under the terms of this License.

       c. If the modified program normally reads commands interactively
          when run, you must cause it, when started running for such
          interactive use in the most ordinary way, to print or display
          an announcement including an appropriate copyright notice and
          a notice that there is no warranty (or else, saying that you
          provide a warranty) and that users may redistribute the
          program under these conditions, and telling the user how to
          view a copy of this License.  (Exception: if the Program
          itself is interactive but does not normally print such an
          announcement, your work based on the Program is not required
          to print an announcement.)

     These requirements apply to the modified work as a whole.  If
     identifiable sections of that work are not derived from the
     Program, and can be reasonably considered independent and separate
     works in themselves, then this License, and its terms, do not
     apply to those sections when you distribute them as separate
     works.  But when you distribute the same sections as part of a
     whole which is a work based on the Program, the distribution of
     the whole must be on the terms of this License, whose permissions
     for other licensees extend to the entire whole, and thus to each
     and every part regardless of who wrote it.

     Thus, it is not the intent of this section to claim rights or
     contest your rights to work written entirely by you; rather, the
     intent is to exercise the right to control the distribution of
     derivative or collective works based on the Program.

     In addition, mere aggregation of another work not based on the
     Program with the Program (or with a work based on the Program) on
     a volume of a storage or distribution medium does not bring the
     other work under the scope of this License.

  4. You may copy and distribute the Program (or a work based on it,
     under Section 2) in object code or executable form under the terms
     of Sections 1 and 2 above provided that you also do one of the
     following:

       a. Accompany it with the complete corresponding machine-readable
          source code, which must be distributed under the terms of
          Sections 1 and 2 above on a medium customarily used for
          software interchange; or,

       b. Accompany it with a written offer, valid for at least three
          years, to give any third party, for a charge no more than your
          cost of physically performing source distribution, a complete
          machine-readable copy of the corresponding source code, to be
          distributed under the terms of Sections 1 and 2 above on a
          medium customarily used for software interchange; or,

       c. Accompany it with the information you received as to the offer
          to distribute corresponding source code.  (This alternative is
          allowed only for noncommercial distribution and only if you
          received the program in object code or executable form with
          such an offer, in accord with Subsection b above.)

     The source code for a work means the preferred form of the work for
     making modifications to it.  For an executable work, complete
     source code means all the source code for all modules it contains,
     plus any associated interface definition files, plus the scripts
     used to control compilation and installation of the executable.
     However, as a special exception, the source code distributed need
     not include anything that is normally distributed (in either
     source or binary form) with the major components (compiler,
     kernel, and so on) of the operating system on which the executable
     runs, unless that component itself accompanies the executable.

     If distribution of executable or object code is made by offering
     access to copy from a designated place, then offering equivalent
     access to copy the source code from the same place counts as
     distribution of the source code, even though third parties are not
     compelled to copy the source along with the object code.

  5. You may not copy, modify, sublicense, or distribute the Program
     except as expressly provided under this License.  Any attempt
     otherwise to copy, modify, sublicense or distribute the Program is
     void, and will automatically terminate your rights under this
     License.  However, parties who have received copies, or rights,
     from you under this License will not have their licenses
     terminated so long as such parties remain in full compliance.

  6. You are not required to accept this License, since you have not
     signed it.  However, nothing else grants you permission to modify
     or distribute the Program or its derivative works.  These actions
     are prohibited by law if you do not accept this License.
     Therefore, by modifying or distributing the Program (or any work
     based on the Program), you indicate your acceptance of this
     License to do so, and all its terms and conditions for copying,
     distributing or modifying the Program or works based on it.

  7. Each time you redistribute the Program (or any work based on the
     Program), the recipient automatically receives a license from the
     original licensor to copy, distribute or modify the Program
     subject to these terms and conditions.  You may not impose any
     further restrictions on the recipients' exercise of the rights
     granted herein.  You are not responsible for enforcing compliance
     by third parties to this License.

  8. If, as a consequence of a court judgment or allegation of patent
     infringement or for any other reason (not limited to patent
     issues), conditions are imposed on you (whether by court order,
     agreement or otherwise) that contradict the conditions of this
     License, they do not excuse you from the conditions of this
     License.  If you cannot distribute so as to satisfy simultaneously
     your obligations under this License and any other pertinent
     obligations, then as a consequence you may not distribute the
     Program at all.  For example, if a patent license would not permit
     royalty-free redistribution of the Program by all those who
     receive copies directly or indirectly through you, then the only
     way you could satisfy both it and this License would be to refrain
     entirely from distribution of the Program.

     If any portion of this section is held invalid or unenforceable
     under any particular circumstance, the balance of the section is
     intended to apply and the section as a whole is intended to apply
     in other circumstances.

     It is not the purpose of this section to induce you to infringe any
     patents or other property right claims or to contest validity of
     any such claims; this section has the sole purpose of protecting
     the integrity of the free software distribution system, which is
     implemented by public license practices.  Many people have made
     generous contributions to the wide range of software distributed
     through that system in reliance on consistent application of that
     system; it is up to the author/donor to decide if he or she is
     willing to distribute software through any other system and a
     licensee cannot impose that choice.

     This section is intended to make thoroughly clear what is believed
     to be a consequence of the rest of this License.

  9. If the distribution and/or use of the Program is restricted in
     certain countries either by patents or by copyrighted interfaces,
     the original copyright holder who places the Program under this
     License may add an explicit geographical distribution limitation
     excluding those countries, so that distribution is permitted only
     in or among countries not thus excluded.  In such case, this
     License incorporates the limitation as if written in the body of
     this License.

 10. The Free Software Foundation may publish revised and/or new
     versions of the General Public License from time to time.  Such
     new versions will be similar in spirit to the present version, but
     may differ in detail to address new problems or concerns.

     Each version is given a distinguishing version number.  If the
     Program specifies a version number of this License which applies
     to it and "any later version", you have the option of following
     the terms and conditions either of that version or of any later
     version published by the Free Software Foundation.  If the Program
     does not specify a version number of this License, you may choose
     any version ever published by the Free Software Foundation.

 11. If you wish to incorporate parts of the Program into other free
     programs whose distribution conditions are different, write to the
     author to ask for permission.  For software which is copyrighted
     by the Free Software Foundation, write to the Free Software
     Foundation; we sometimes make exceptions for this.  Our decision
     will be guided by the two goals of preserving the free status of
     all derivatives of our free software and of promoting the sharing
     and reuse of software generally.

                                NO WARRANTY

 12. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
     WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
     LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
     HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
     WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT
     NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
     FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE
     QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
     PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
     SERVICING, REPAIR OR CORRECTION.

 13. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
     WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY
     MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE
     LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
     INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
     INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
     DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU
     OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
     OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN
     ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

                      END OF TERMS AND CONDITIONS

Appendix: How to Apply These Terms to Your New Programs
=======================================================

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

     ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES.
     Copyright (C) 19YY  NAME OF AUTHOR

     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.

     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.

     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

  Also add information on how to contact you by electronic and paper
mail.

  If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

     Gnomovision version 69, Copyright (C) 19YY NAME OF AUTHOR
     Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
     This is free software, and you are welcome to redistribute it
     under certain conditions; type `show c' for details.

  The hypothetical commands `show w' and `show c' should show the
appropriate parts of the General Public License.  Of course, the
commands you use may be called something other than `show w' and `show
c'; they could even be mouse-clicks or menu items--whatever suits your
program.

  You should also get your employer (if you work as a programmer) or
your school, if any, to sign a "copyright disclaimer" for the program,
if necessary.  Here is a sample; alter the names:

     Yoyodyne, Inc., hereby disclaims all copyright interest in the program
     `Gnomovision' (which makes passes at compilers) written by James Hacker.

     SIGNATURE OF TY COON, 1 April 1989
     Ty Coon, President of Vice

  This General Public License does not permit incorporating your
program into proprietary programs.  If your program is a subroutine
library, you may consider it more useful to permit linking proprietary
applications with the library.  If this is what you want to do, use the
GNU Library General Public License instead of this License.

Regain your programming freedom
*******************************

  Until a few years ago, programmers in the United States could write
any program they wished.  This freedom has now been taken away by two
developments: software patents, which grant the patent holder an
absolute monopoly on some programming technique, and user interface
copyright, which forbid compatible implementations of an existing user
interface.

  In Europe, especially through the GATT treaty, things are rapidly
approaching the same pass.

Software patents
================

  The U.S. Patent and Trademark Office has granted numerous software
patents on software techniques.  Patents are an absolute
monopoly--independent reinvention is precluded.  This monopoly lasts
for seventeen years, i.e., forever (with respect to computer science).

  One patent relevant to TeX is patent 4,956,809, issued to the Mark
Williams company on September 11, 1990, applied for in 1982, which
covers (among other things)
     representing in a standardized order consisting of a standard
     binary structure file stored on auxiliary memory or transported on
     a communications means, said standardized order being different
     from a different order used on at least one of the different
     computers;

     Converting in each of the different computers binary data read
     from an auxiliary data storage or communications means from the
     standardized order to the natural order of the respective host
     computer after said binary data are read from said auxiliary data
     storage or communications means and before said binary data are
     used by the respective host computer; and

     Converting in each of the different computers binary data written
     into auxiliary data storage or communications means from the
     natural order of the respective host computer to the standardized
     order prior to said writing.

... in other words, storing data on disk in a machine-independent
order, as the DVI, TFM, GF, and PK file formats specify.  Even though
TeX is "prior art" in this respect, the patent was granted (the patent
examiners not being computer scientists, even less computer
typographers).  Since there is a strong presumption in the courts of a
patent's validity once it has been granted, there is a good chance that
users or implementors of TeX could be successfully sued on the issue.

  As another example, the X window system, which was intended to be able
to be used freely by everyone, is now being threatened by two patents:
4,197,590 on the use of exclusive-or to redraw cursors, held by Cadtrak,
a litigation company (this has been upheld twice in court); and
4,555,775, held by AT&T, on the use of backing store to redraw windows
quickly.

  Here is one excerpt from a recent mailing by the League for
Programming Freedom (see What to do?.) which I feel sums up the
situation rather well.  It comes from an article in `Think' magazine,
issue #5, 1990.  The comments after the quote were written by Richard
Stallman.

         "You get value from patents in two ways," says Roger Smith, IBM
        Assistant General Counsel, intellectual property law.
     "Through fees,     and through licensing negotiations that give
     IBM access to other     patents.

     "The IBM patent portfolio gains us the freedom to do what we need
     to     do through cross-licensing--it gives us access to the
     inventions of     others that are the key to rapid innovation.
     Access is far more     valuable to IBM than the fees it receives
     from its 9,000 active     patents.  There's no direct calculation
     of this value, but it's many     times larger than the fee income,
     perhaps an order of magnitude     larger."

  This information should dispel the belief that the patent system will
"protect" a small software developer from competition from IBM.  IBM
can always find patents in its collection which the small developer is
infringing, and thus obtain a cross-license.

  However, the patent system does cause trouble for the smaller
companies which, like IBM, need access to patented techniques in order
to do useful work in software.  Unlike IBM, the smaller companies do
not have 9,000 patents and cannot usually get a cross-license.  No
matter how hard they try, they cannot have enough patents to do this.

  Only the elimination of patents from the software field can enable
most software developers to continue with their work.

  The value IBM gets from cross-licensing is a measure of the amount of
harm that the patent system would do to IBM if IBM could not avoid it.
IBM's estimate is that the trouble could easily be ten times the good
one can expect from one's own patents--even for a company with 9,000 of
them.

User interface copyright
========================

  (This section is copied from the GCC manual, by Richard Stallman.)

     This section is a political message from the League for Programming
     Freedom to the users of the GNU font utilities.  It is included
     here as an expression of support for the League on my part.

  Apple, Lotus and Xerox are trying to create a new form of legal
monopoly: a copyright on a class of user interfaces.  These monopolies
would cause serious problems for users and developers of computer
software and systems.

  Until a few years ago, the law seemed clear: no one could restrict
others from using a user interface; programmers were free to implement
any interface they chose.  Imitating interfaces, sometimes with changes,
was standard practice in the computer field.  The interfaces we know
evolved gradually in this way; for example, the Macintosh user interface
drew ideas from the Xerox interface, which in turn drew on work done at
Stanford and SRI.  1-2-3 imitated VisiCalc, and dBase imitated a
database program from JPL.

  Most computer companies, and nearly all computer users, were happy
with this state of affairs.  The companies that are suing say it does
not offer "enough incentive" to develop their products, but they must
have considered it "enough" when they made their decision to do so.  It
seems they are not satisfied with the opportunity to continue to compete
in the marketplace--not even with a head start.

  If Xerox, Lotus, and Apple are permitted to make law through the
courts, the precedent will hobble the software industry:

   * Gratuitous incompatibilities will burden users.  Imagine if each
     car manufacturer had to arrange the pedals in a different order.

   * Software will become and remain more expensive.  Users will be
     "locked in" to proprietary interfaces, for which there is no real
     competition.

   * Large companies have an unfair advantage wherever lawsuits become
     commonplace.  Since they can easily afford to sue, they can
     intimidate small companies with threats even when they don't
     really have a case.

   * User interface improvements will come slower, since incremental
     evolution through creative imitation will no longer be permitted.

   * Even Apple, etc., will find it harder to make improvements if they
     can no longer adapt the good ideas that others introduce, for fear
     of weakening their own legal positions.  Some users suggest that
     this stagnation may already have started.

   * If you use GNU software, you might find it of some concern that
     user interface copyright will make it hard for the Free Software
     Foundation to develop programs compatible with the interfaces that
     you already know.

What to do?
===========

  (This section is copied from the GCC manual, by Richard Stallman.)

  To protect our freedom from lawsuits like these, a group of
programmers and users have formed a new grass-roots political
organization, the League for Programming Freedom.

  The purpose of the League is to oppose new monopolistic practices such
as user-interface copyright and software patents; it calls for a return
to the legal policies of the recent past, in which these practices were
not allowed.  The League is not concerned with free software as an
issue, and not affiliated with the Free Software Foundation.

  The League's membership rolls include John McCarthy, inventor of Lisp,
Marvin Minsky, founder of the Artificial Intelligence lab, Guy L.
Steele, Jr., author of well-known books on Lisp and C, as well as
Richard Stallman, the developer of GNU CC.  Please join and add your
name to the list.  Membership dues in the League are $42 per year for
programmers, managers and professionals; $10.50 for students; $21 for
others.

  The League needs both activist members and members who only pay their
dues.

  To join, or for more information, phone (617) 492-0023 or write to:

     League for Programming Freedom
     1 Kendall Square #143
     P.O. Box 9171
     Cambridge, MA 02139

  You can also send electronic mail to `league@prep.ai.mit.edu'.

  Here are some suggestions from the League for things you can do to
protect your freedom to write programs:

   * Don't buy from Xerox, Lotus or Apple.  Buy from their competitors
     or from the defendants they are suing.

   * Don't develop software to work with the systems made by these
     companies.

   * Port your existing software to competing systems, so that you
     encourage users to switch.

   * Write letters to company presidents to let them know their conduct
     is unacceptable.

   * Tell your friends and colleagues about this issue and how it
     threatens to ruin the computer industry.

   * Above all, don't work for the look-and-feel plaintiffs, and don't
     accept contracts from them.

   * Write to Congress to explain the importance of this issue.

          House Subcommittee on Intellectual Property
          2137 Rayburn Bldg
          Washington, DC 20515

          Senate Subcommittee on Patents, Trademarks and Copyrights
          United States Senate
          Washington, DC 20510

     (These committees have received lots of mail already; let's give
     them even more.)

  Express your opinion!  You can make a difference.

Index
*****