home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / unixtex-6.1b-bin0.lha / info / kpathsea.info-1 (.txt) < prev    next >
GNU Info File  |  1996-10-12  |  51KB  |  923 lines

  1. This is Info file kpathsea.info, produced by Makeinfo-1.64 from the
  2. input file /ade-src/contrib/unixtex/kpathsea/kpathsea.texi.
  3. START-INFO-DIR-ENTRY
  4. * Kpathsea: (kpathsea).        File lookup along search paths.
  5. END-INFO-DIR-ENTRY
  6.   This file documents the Kpathsea library for path searching.
  7.   Copyright (C) 1993, 94, 95 Karl Berry.
  8.   Permission is granted to make and distribute verbatim copies of this
  9. manual provided the copyright notice and this permission notice are
  10. preserved on all copies.
  11.   Permission is granted to copy and distribute modified versions of this
  12. manual under the conditions for verbatim copying, provided also that the
  13. sections entitled "Freedom" and "GNU General Public License" are
  14. included exactly as in the original, and provided that the entire
  15. resulting derived work is distributed under the terms of a permission
  16. notice identical to this one.
  17.   Permission is granted to copy and distribute translations of this
  18. manual into another language, under the above conditions for modified
  19. versions, except that the sections entitled "Freedom" and "GNU General
  20. Public License" may be included in a translation approved by the Free
  21. Software Foundation instead of in the original English.
  22. File: kpathsea.info,  Node: Top,  Next: Introduction,  Up: (dir)
  23. Kpathsea library
  24. ****************
  25.   This manual documents how to install and use the Kpathsea library for
  26. filename lookup.  It corresponds to version 2.6 (released in January
  27. 1995).
  28. * Menu:
  29. * Introduction::                Overview.
  30. * Installation::                Compilation, installation, and bug reporting.
  31. * Debugging::            Analyzing runtime problems.
  32. * Path searching::        How filename lookups work.
  33. * TeX searching::        Special support for TeX lookups.
  34. * TeX directory structure::    Ways to manage the many input files.
  35. * Programming::            How to use the library in your program.
  36. * Copying::                     Conditions for copying, modifying and sharing.
  37. * Freedom::                     Regain your programming freedom.
  38. * Index::                       General index.
  39. File: kpathsea.info,  Node: Introduction,  Next: Installation,  Prev: Top,  Up: Top
  40. Introduction
  41. ************
  42.   This manual corresponds to version 2.6 of the Kpathsea library,
  43. released in January 1995.
  44.   The library's fundamental purpose is to look up a file in a list of
  45. directories specified by the user, similar to what shells do when
  46. looking up program names to execute.
  47.   The following software, all of which I maintain, uses this library:
  48.    * Dviljk
  49.    * Dvipsk (*note Introduction: (dvipsk)Top.)
  50.    * GNU font utilities (*note Introduction: (fontu)Top.)
  51.    * Web2c (*note Introduction: (web2c)Top.)
  52.    * Xdvik
  53.   The library is still under development (and probably always will be,
  54. despite my hopes). I do not promise to keep the interface unchanged.  If
  55. you have comments or suggestions, please send them to me (*note
  56. Reporting bugs::.).
  57.   Currently, I distribute the library under the GNU General Public
  58. License (*note Copying::.).  In short, this means if you write a
  59. program using the library, you must (offer to) distribute the source,
  60. and allow anyone to modify the source and distribute their
  61. modifications.
  62.   If you have a problem with this, contact me. I would consider putting
  63. the library under the GNU Library General Public License, which would
  64. permit you to distribute the source only to the library, not to your
  65. program using it.  But I will only do this if someone actually says they
  66. will not use the library under the GPL conditions, and would use it
  67. under the LGPL.
  68.   If you know enough about TeX to be reading this manual, then you (or
  69. perhaps your institution) should consider joining the TeX Users Group
  70. (if you're already a member, great!).  TUG produces a periodical called
  71. `TUGboat', sponsors an annual meeting (the proceedings of which are
  72. published in `TUGboat'), and arranges courses on TeX for all levels of
  73. users.  Given sufficient funding (which your joining will help) TUG
  74. could sponsor more projects that will benefit the TeX community, such as
  75. a successor to TeX pi .  Anyway, here is the address:
  76.      TeX Users Group
  77.      P.O. Box 869
  78.      Santa Barbara, CA 93102 USA
  79.      phone: (805) 899-4673
  80.      email: `tug@tug.org'
  81. * Menu:
  82. * History::
  83. File: kpathsea.info,  Node: History,  Up: Introduction
  84. History
  85. =======
  86.   (This section is for those people who are curious about how this came
  87. about.) (If you like to read historical accounts of software, I urge
  88. you to seek out the GNU Autoconf manual and, even more fun, the "Errors
  89. of TeX" paper that Don Knuth published in `Software--Practice and
  90. Experience'.)
  91.   My first ChangeLog entry for Web2c seems to be February 1990, but I
  92. may have done some stuff before then.  In any case, Tim Morgan and I
  93. were sort of jointly maintaining it for a time.  (I should say that Tim
  94. had made Web2c into a real distribution long before I had ever used it
  95. or even heard of it, and Tom Rokicki did the original implementation.)
  96.   It must have been later in 1990 and 1991 that I started working on
  97. `TeX for the Impatient' and Dvips, Xdvi, Web2c, and the GNU fontutils
  98. (which I was also writing at the time) using different environment
  99. variables, and, even more importantly, having different bugs in their
  100. path searching became extremely painful.  I also desperately wanted to
  101. implement subdirectory searching, since I couldn't stand putting
  102. everything in one big directory, and also couldn't stand having to
  103. explicitly specify `pandora', `cm' in a path.
  104.   In the first incarnation, I just hacked separately on each program--
  105. that was the original subdirectory searching code in both Xdvi and
  106. Dvips, though I think Paul Vojta has completely rewritten Xdvi's support
  107. by now.  That is, I tried to go with the flow in each program, rather
  108. than changing the program's calling sequences to conform to common
  109. routines.
  110.   Then, as bugs inevitably appeared, I found I was fixing the same thing
  111. in each of three (Web2c and fontutils were always sharing code, since I
  112. maintained those--there was no Dvipsk or Xdvik or Dviljk at this
  113. point).  After a while, I finally started sharing source files.  They
  114. weren't a library, though.  I just kept things up to date with shell
  115. scripts.  (I was developing on a 386 running ISC 2.2 at the time, and so
  116. didn't have symbolic links.  An awful experience.)
  117.   Things kept on like this for quite a while.  The `ChangeLog's for
  118. Xdvik and Dvipsk record initial releases of those distributions in May
  119. and June 1992.  I think it was because I was tired of the different
  120. configuration strategies of each program, not so much because of the
  121. path searching.  (Autoconf was being developed by David MacKenzie and
  122. others, and I was adapting it to TeX and friends.)
  123.   I starting to make it a separate library that other programs could
  124. link with on my birthday in April 1993, according to the ChangeLog.  I
  125. don't remember exactly why I finally took the time to make it a separate
  126. library; I think it was a conversation with david zuhn that led to doing
  127. it.  Just seemed like it was time.
  128.   Dviljk got started in March 1994 after I bought a Laserjet 4.
  129. (Kpathsea work got suspended while Norm Walsh and I, with Gustaf
  130. Neumann's help, implemented a way for TeX to get at all those neat
  131. builtin LJ4 fonts ... such a treat to have something to typeset in
  132. besides Palatino!)
  133.   At this point (October 1994), I've implemented just about all the
  134. path-searching features in Kpathsea that I ever intended to (and some I
  135. didn't intend ...). After the next stable release of Web2c, I figure
  136. I'll be able to stop development, and turn most of my attention back to
  137. making fonts for GNU.  (Always assuming Microsoft hasn't completely
  138. obliterated Unix by then, or that software patents haven't stopped
  139. software development by anybody smaller than a company with a
  140. million-dollar-a-year legal budget.  Which is actually what I think is
  141. likely to happen, but that's another story...)
  142. File: kpathsea.info,  Node: Installation,  Next: Debugging,  Prev: Introduction,  Up: Top
  143. Installation
  144. ************
  145.   Here are the basic steps for configuration and installation:
  146.   1. Edit the file `make/paths.make' if you want to make changes to the
  147.      installation directories or paths that will have effect across
  148.      different runs of `configure'.  Alternatively, override the Make
  149.      variables on the command line when you run Make.
  150.      Exception: to reliably change the top-level `prefix', you must give
  151.      `configure' the option `-prefix=PREFIX', instead of changing the
  152.      value in `paths.make'.
  153.   2. Edit `kpathsea/texmf.cnf.in' to change the local paths to match
  154.      your local setup.  *Note Default paths: (kpathsea)Default paths,
  155.      for more details on changing the paths. A copy is in
  156.      `kpathsea/INSTALL'.  See `kpathsea/HIER' for an explanation of the
  157.      default setup.
  158.      If the paths do not match where the files actually are, the
  159.      programs will probably start up Very, Very, Slowly, and/or not be
  160.      able to find the fonts or other input files.
  161.   3. `sh configure' (in the top-level directory).  This makes
  162.      system-dependent `#define's' in `*/c-auto.h' (from the
  163.      corresponding `c-auto.h.in') and creates a `Makefile' (from the
  164.      corresponding `Makefile.in', by doing `@VAR@' and `ac_include'
  165.      substitutions).
  166.      Perhaps the most common desire is to compile with optimization
  167.      instead of or as well as debugging.  You can change the options
  168.      passed to the compiler by changing `CFLAGS', either for
  169.      `configure' or `make'.  For example:
  170.           prompt$ env CFLAGS="-g -O" configure
  171.           prompt$ make
  172.      or
  173.           prompt$ configure
  174.           prompt$ make CFLAGS="-g -O"
  175.      *Note Running `configure' scripts: (autoconf)Invoking configure,
  176.      for detailed `configure' options.  (A copy is in
  177.      `kpathsea/CONFIGURE'.)
  178.   4. `make' (still in the top-level directory). Barring configuration
  179.      and compiler bugs, this will compile all the programs.  *Note
  180.      Common problems: (kpathsea)Common problems, for system-dependent
  181.      problems (this section is also in `kpathsea/INSTALL').
  182.      This also creates the `texmf.cnf' and `paths.h' files that define
  183.      the default search paths.
  184.   5. `make install'. This installs the library, header files, and
  185.      documentation. Or `make install-data' to just install the
  186.      architecture-independent files. Or `make install-exec' to just
  187.      install the (binary) archive library file.
  188.      Since I only distribute Kpathsea as part of another package, you
  189.      will probably be doing the above in a top-level directory that
  190.      contains a `Makefile', `kpathsea', and the other package.  But you
  191.      can do the installation in `kpathsea' itself, if you only want to
  192.      install the library, not the other package.
  193.   6. The first time you install any manual in Info, you have to add a
  194.      line (you choose where) to the `dir' file in your `$(infodir)'
  195.      directory.  A sample line to add is given near the top of the
  196.      Texinfo source files (`kpathsea/kpathsea.texi' and
  197.      `dvipsk/dvips.texi').
  198.   7. `make distclean'.  This removes all files created by the build.
  199.   *Note Filename database::, for a description of an
  200. externally-generated database that can help speed searches.
  201.   *Note Debugging::, for runtime debugging support that may help track
  202. down problems.
  203.   Do not attempt to use any version of Kpathsea with any program except
  204. the version that the program came with, unless you are a glutton for
  205. punishment.
  206. * Menu:
  207. * Default paths::    Changing default installation directories and paths.
  208. * Common problems::    When things go wrong.
  209. * Shared library::    Making Kpathsea a shared library.
  210. * Reporting bugs::    Where and how to report bugs.
  211. File: kpathsea.info,  Node: Default paths,  Next: Common problems,  Up: Installation
  212. Default paths
  213. =============
  214.   To summarize the chain of events that go into defining the default
  215. paths:
  216.   1. `configure' creates a `Makefile' from each `Makefile.in'.
  217.   2. When Make runs in the `kpathsea' directory, it creates a file
  218.      `texmf.sed' that substitutes the Make value of `$(var)' for a
  219.      string `@var@'. The variables in question are the one that define
  220.      the installation directories.
  221.   3. `texmf.sed' (and a little extra magic--see `kpathsea/Makefile') is
  222.      applied to `texmf.cnf.in' to generate `texmf.cnf'. This is the
  223.      file that will eventually be installed and used by the programs to
  224.      look up programs.
  225.   4. The definitions in `texmf.cnf' are changed into the form of C
  226.      `#define''s, producing `paths.h'. These values will be the
  227.      compile-time defaults; they are not used unless no `texmf.cnf' file
  228.      can be found at runtime.
  229.      (That's a partial lie: the compile-time defaults are what extra
  230.      `:''s in `texmf.cnf' expand into; but the paths as distributed
  231.      have no extra `:''s, and there's no particular reason for them to.)
  232.   The purpose of this elaborate sequence is to avoid having the same
  233. information in more than one place. If you change the installation
  234. directories or top-level prefix before running `configure', those
  235. changes will propagate through the whole sequence. If you change the
  236. default paths in `texmf.cnf.in', those changes are propagated to the
  237. compile-time defaults.
  238.   Alternatively, you can ignore the whole mess and edit `texmf.cnf'
  239. after it is installed. Maybe even copying it into place beforehand so
  240. you can complete the installation, if TeX or Metafont is having trouble
  241. finding their input files.
  242.   Unfortunately, editing `Makefile.in' *does not work* in one common
  243. case--changing the `prefix' or `exec_prefix' variables. For these, you
  244. must use the `-prefix' or `-exec-prefix' options to `configure'.  *Note
  245. Running `configure' scripts: (autoconf)Running configure Scripts.
  246. (That's another partial lie: editing does work, as long as a program
  247. named `tex' is not in your `PATH'.)
  248.   *Note TeX directory structure: TeX directory structure, for a
  249. description of some ways to arrange the TeX library files, and some
  250. features of the distributed paths that may not be obvious.  The file
  251. `kpathsea/HIER' is a copy of that section.
  252.   The Make definitions are all repeated in several `Makefile''s; but
  253. changing the top-level `Makefile' should suffice, as it passes down all
  254. the variable definitions, thus overriding the submakes. (The
  255. definitions are repeated so you can potentially run Make in the
  256. subdirectories.)
  257. File: kpathsea.info,  Node: Common problems,  Next: Shared library,  Prev: Default paths,  Up: Installation
  258. Common problems
  259. ===============
  260.   Some common problems with compilation, linking, or execution are
  261. described below.
  262. * Menu:
  263. * Unable to find files:: If your program can't find fonts or anything else.
  264. * Slow path searching::  If it takes forever to find anything.
  265. * XtInherit::        For XtInherit link problems on OSF/1 1.x.
  266. * wchar_t::        For wchar_t difficulties.
  267. * ShellWidgetClass::    For dynamic linking with Sun's openwin libraries.
  268. * Pointer combination warnings:: For old compilers that don't grok char *.
  269. File: kpathsea.info,  Node: Unable to find files,  Next: Slow path searching,  Up: Common problems
  270. Unable to find files
  271. --------------------
  272.   If a program complains it cannot find fonts (or other input files),
  273. any of several things might be wrong:
  274.    * You don't have the fonts (or whatever) installed. Nothing will
  275.      automatically generate TFM files or TeX and Metafont sources for
  276.      you (by default). *Note Obtaining Web2c: (web2c)Obtaining Web2c.
  277.      You can, however, configure TeX and Metafont to run a script to
  278.      generate these input files, if you have (or write) such scripts.
  279.      *Note `MakeTeX'... invocation: (web2c)MakeTeX... invocation.
  280.    * You have (perhaps unknowingly) told Kpathsea to use search paths
  281.      that don't reflect where the files actually are. One common cause
  282.      is having environment variables set, thus overriding what you
  283.      carefully set in `texmf.cnf'. *Note TeX environment variables: TeX
  284.      environment variables.
  285.    * Your files reside in a directory that is only pointed to via a
  286.      symbolic link, in a leaf directory.
  287.      Unfortunately, Kpathsea's subdirectory searching has a (congenital)
  288.      deficiency: If a directory D being searched for subdirectories
  289.      contains plain files and symbolic links to other directories, but
  290.      no true subdirectories, D will be considered a leaf directory,
  291.      i.e., the symbolic links will not be followed.  *Note Subdirectory
  292.      expansion::, for an explanation of why this happens.
  293.      You can work around this problem by creating an empty dummy
  294.      subdirectory in D. Then D will no longer be a leaf, and the
  295.      symlinks will be followed.
  296.      The directory immediately followed by the `//' in the path
  297.      specification, however, is always searched for subdirectories,
  298.      even if it is a leaf.  This is since presumably you would not have
  299.      asked for the directory to be searched for subdirectories if you
  300.      didn't want it to be.
  301.    * There is a bug in the library. *Note Reporting bugs::.
  302.   In any case, you may find the debugging options helpful in determining
  303. precisely where the fonts (or whatever) are being looked for. See the
  304. program's documentation for its debugging options, and also *note
  305. Debugging::..
  306. File: kpathsea.info,  Node: Slow path searching,  Next: XtInherit,  Prev: Unable to find files,  Up: Common problems
  307. Slow path searching
  308. -------------------
  309.   If your program takes an excessively long time to find fonts or other
  310. input files, but does eventually succeed, here are some possible
  311. culprits:
  312.    * Most likely, you just have a lot of directories to search, and that
  313.      takes a noticeable time. The solution is to create and maintain a
  314.      separate `ls-R' file that lists all the files in your main TeX
  315.      hierarchy. *Note Filename database::.  (Kpathsea always uses `ls-R'
  316.      if it's present; there's no need to recompile or reinstall any of
  317.      the programs.)
  318.    * Your recursively-searched directories (e.g.,
  319.      `/usr/local/lib/tex/fonts//'), contain a mixture of files and
  320.      directories. This prevents Kpathsea from using a useful
  321.      optimization (*note Subdirectory expansion::.).
  322.      It is best to have only directories (and perhaps a `README') in the
  323.      upper levels of the directory structure, and it's very important
  324.      to have *only* files, and no subdirectories, in the directories
  325.      where the dozens of TFM, PK, or whatever files reside.
  326.    * Finally, one simple-to-fix (but unlikely) cause: If you recursively
  327.      search `$HOME' or `~', and you are running as `root', you will
  328.      search every directory on the system.  This typically takes quite
  329.      some time!
  330.   In any case, you may find the debugging options helpful in determining
  331. precisely when the disk or network is being pounded. *Note Debugging::,
  332. and also see the program's documentation.
  333. File: kpathsea.info,  Node: XtInherit,  Next: wchar_t,  Prev: Slow path searching,  Up: Common problems
  334. `XtInherit'
  335. -----------
  336.   On DEC OSF/1 1.x systems, the loader has a bug that manifests itself
  337. in the following error (all on one line, but for the sake of the paper
  338. width it's broken here):
  339.      xdvik/xdvi: /sbin/loader: Fatal Error: search_for_undefineds:
  340.           symbol _XtInherit should not have any relocation entry
  341. According to Michael Rickabaugh `<mjr@quarry.enet.dec.com>':
  342.      This is a bug fixed in DEC OSF/1 2.0.
  343.      
  344.      If you know how, installing `/sbin/loader' from a 2.0 system onto a
  345.      1.3 system will work.  Make sure that `/usr' is *not* mounted
  346.      when you do this.  (If you forget about umounting `/usr', it is
  347.      possible most of your filesystems will become corrupted.)
  348.      
  349.      Otherwise, I suggest getting a hold of a 2.0 CD and running
  350.      `/usr/sbin/installupdate'.
  351.   Alternatively, you may be able to use the freely available X11
  352. libraries that come with the MIT distribution (on `ftp.x.org', for
  353. example).
  354.   Linking statically, perhaps only with some of the X libraries, may
  355. also work.  (if you find the definitive workaround, please let me know.)
  356. File: kpathsea.info,  Node: wchar_t,  Next: ShellWidgetClass,  Prev: XtInherit,  Up: Common problems
  357. `wchar_t'
  358. ---------
  359.   The upshot of all the following is that if you get error messages
  360. regarding `wchar_t', try defining `NO_FOIL_X_WCHAR_T' (for Web2c) or
  361. `FOIL_X_WCHAR_T' (for everything else).
  362.   `wchar_t' has caused infinite trouble. None of my code ever uses
  363. `wchar_t'; all I want to do is include X header files and various
  364. system header files, possibly compiling with GCC. This seems an
  365. impossible task!
  366.   The X11 header `<Xlib.h>' and GCC's `<stddef.h>' have conflicting
  367. definitions for wchar_t.
  368.   The particulars: `<X11/Xlib.h>' from MIT X11R5 defines `wchar_t' if
  369. `X_WCHAR' is defined, which is defined if `X_NOT_STDC_ENV' is defined,
  370. and we define *that* if `STDC_HEADERS' is not defined (`configure'
  371. decides if STDC_HEADERS gets defined).  But when compiling with gcc on
  372. SunOS 4.1.x, `STDC_HEADERS' is not defined (`string.h' doesn't declare
  373. the `mem'* functions), so we do get X's `wchar_t'--and we also get
  374. gcc's `wchar_t' from its `<stddef.h>'.  Conflict.
  375.   On the other hand, SunOS 4.1.1 with some other X configurations
  376. actually needs GCC to define `wchar_t', and fails otherwise.
  377.   My current theory is to define `wchar_t' to a nonsense symbol before
  378. the X include files are read; that way its definition (if any) will be
  379. ignored by other system include files.  Going along with that, define
  380. `X_WCHAR' to tell X not to use `<stddef.h>', that we've already
  381. included, but instead to make its own definition.
  382.   But this is not the end of the story. The X11 include files
  383. distributed with DG/UX 5.4.2 for the Aviion have been modified to
  384. include `<_int_wchar_t.h>' if `X_WCHAR', so our `#define' will not have
  385. any typedef to change--but the uses of `wchar_t' in the X include files
  386. will be changed to reference this undefined symbol. So there's nothing
  387. to foil in this case. I don't know how to detect this automatically, so
  388. it's up to you to define `NO_FOIL_X_WCHAR_T' yourself.
  389. File: kpathsea.info,  Node: ShellWidgetClass,  Next: Pointer combination warnings,  Prev: wchar_t,  Up: Common problems
  390. `ShellWidgetClass'
  391. ------------------
  392.   This section is adapted from question 47 from the
  393. `comp.sys.sun.admin' FAQ.
  394.   If you are linking with Sun's OpenWindows libraries in SunOS 4.1.x,
  395. you may get undefined symbols `_get_wmShellWidgetClass' and
  396. `_get_applicationShellWidgetClass'. This problem does not arise with
  397. the standard MIT libraries under SunOS.
  398.   The cause is bugs in the `Xmu' shared library as shipped from Sun.
  399. There are several fixes:
  400.    * Get the Openwindows patches that apply to this problem.
  401.    * Statically link the `Xmu' library into the executable.
  402.    * Avoid using `Xmu' at all. For this last, if you are compiling
  403.      Metafont, *note Online Metafont graphics: (Web2c)Online Metafont
  404.      graphics.. If you are compiling Xdvi, see the `-DNOTOOL' option in
  405.      `xdvik/INSTALL'.
  406.    * Ignore the errors. The binary runs fine regardless.
  407.   Here is the information for getting the two patches:
  408.      Patch ID: 100512-02
  409.      Bug ID's: 1086793, 1086912, 1074766
  410.      Description: 4.1.x OpenWindows 3.0 `libXt' jumbo patch
  411.      
  412.      Patch ID: 100573-03
  413.      Bug ID: 1087332
  414.      Description: 4.1.x OpenWindows 3.0 undefined symbols when using shared
  415.      `libXmu'.
  416.   The way to statically link with `libXmu' depends on whether you are
  417. using a Sun compiler (e.g., `cc') or `gcc'. If the format, alter the
  418. `x_libs' make variable to include
  419.      -Bstatic -lXmu -Bdynamic
  420.   If you are using `gcc', include `-static' in `LDFLAGS'; this will
  421. link all libraries statically. If you want to link only `Xmu'
  422. statically and everything else dynamically, you have to do it by hand:
  423. run `gcc -v', grab the `ld' line, and add the `-B''s given above around
  424. `-lXmu'.
  425.   The reason is that gcc moves all linker options to the front of the
  426. `ld' command line.  So you can't specify different options for
  427. different libraries.  When I reported this to the GCC maintainers, the
  428. reply was that they would happily merge in the changes, but they didn't
  429. want to take the time to do it themselves.
  430. File: kpathsea.info,  Node: Pointer combination warnings,  Prev: ShellWidgetClass,  Up: Common problems
  431. Pointer combination warnings
  432. ----------------------------
  433.   When compiling with old C compilers, you may get some warnings about
  434. "illegal pointer combinations".  These are spurious; just ignore them.
  435. I decline to clutter up the source with casts to get rid of them.
  436.   In general, if you have trouble with a system C compiler, I advise
  437. trying the GNU C compiler. (And vice versa, unfortunately; but in that
  438. case I also recommend reporting a bug to the GCC bug list.)
  439. File: kpathsea.info,  Node: Shared library,  Next: Reporting bugs,  Prev: Common problems,  Up: Installation
  440. Shared library
  441. ==============
  442.   You can compile Kpathsea as a shared library.  The advantage in doing
  443. this is that the different executables can then share the code,
  444. decreasing memory usage.  (The other advantage in general of shared
  445. libraries is that it's possible to update the library and programs
  446. independently.  But since the Kpathsea interface is not and can not be
  447. frozen, that doesn't apply here.)
  448.   Under Solaris, use `-K pic -xstrconst' if you compile with a Sun
  449. compiler, `-fpic' if you use GCC.  Also add `-L$(LIBDIR) -R$(LIBDIR)'
  450. to `LDFLAGS' when you link the binaries, so that the library can be
  451. found, and users do not have set `LD_LIBRARY_PATH'.
  452.   (If you know how to make Kpathsea shared on other systems, please
  453. send a message to the bug address in the next section.)
  454. File: kpathsea.info,  Node: Reporting bugs,  Prev: Shared library,  Up: Installation
  455. Reporting bugs
  456. ==============
  457.   If you encounter problems, please report them to `tex-k@cs.umb.edu'.
  458. Include the version number of the library, the system you are using, and
  459. enough information to reproduce the bug in your report.  To get on this
  460. mailing list yourself, email `tex-k-request@cs.umb.edu' with a message
  461. whose body contains a line
  462.      subscribe YOU@YOUR.PREFERRED.ADDRESS
  463.   To avoid wasted effort and time (both mine and yours), I strongly
  464. advise applying the principles given in the GNU C manual (*note
  465. Reporting Bugs: (gcc)Bugs.) to your bug reports.
  466.   Please also report bugs in this documentation--not only factual
  467. errors, but unclear explanations, typos, wrong fonts, ...
  468. File: kpathsea.info,  Node: Debugging,  Next: Path searching,  Prev: Installation,  Up: Top
  469. Debugging
  470. *********
  471.   Kpathsea provides a number of runtime debugging options, detailed
  472. below by their names (and corresponding numeric values).  You can set
  473. these with some runtime argument (e.g., `-d') to the program; in that
  474. case, you should use the numeric values described in the program's
  475. documentation (which, except for Dviljk, are different from those
  476. below).
  477.   You can also set the environment variable `KPATHSEA_DEBUG'.  In this
  478. case, you should use the numbers below.  Also use the numbers below if
  479. you run the program under a debugger and set the the variable
  480. `kpathsea_debug' yourself.
  481.   In any case, you can *not* use the *names* below; you must always use
  482. somebody's numbers. (Sorry.)  And to set more than option, just sum the
  483. corresponding numbers.
  484. `KPSE_DEBUG_STAT'
  485.      (1). Reports `stat'(2) calls. This is useful for verifying that
  486.      your directory structure is not forcing Kpathsea to do many
  487.      additional file tests (*note Slow path searching::. and *note
  488.      Subdirectory expansion::.). If you are using an up-to-date `ls-R'
  489.      database (*note Filename database::.), this should produce no
  490.      output unless a nonexistent file is searched for.
  491. `KPSE_DEBUG_HASH'
  492.      (2). Reports lookups in all hash tables, including `ls-R' (*note
  493.      Filename database::.), font aliases (*note Fontmap::.), and config
  494.      file values (*note Config files::.).  Useful when expected values
  495.      are not being found, e.g.., file searches are looking at the disk
  496.      instead of using `ls-R'.
  497. `KPSE_DEBUG_FOPEN'
  498.      (4). Reports file openings and closings. Especially useful when
  499.      your system's file table is full, for seeing if some files have
  500.      been opened but never closed. In case you want to set breakpoints:
  501.      this works by redefining `fopen' (`fclose') to be
  502.      `kpse_fopen_trace' (`kpse_fclose_trace').
  503. `KPSE_DEBUG_PATHS'
  504.      (8). Reports general path information for each file type Kpathsea
  505.      is asked to search. This is useful when you are trying to track
  506.      down how a particular path got defined--from `texmf.cnf',
  507.      `config.ps', the compile-time default, an environment variable,
  508.      etc.  This is the contents of a structure defined in `tex-file.h'.
  509. `KPSE_DEBUG_EXPAND'
  510.      (16). Reports the directory list corresponding to each path element
  511.      Kpathsea searches in. This is only relevant when Kpathsea is
  512.      searching the disk, since `ls-R' searches don't look through
  513.      directory lists in this way (they go straight to the file using
  514.      the hash table).
  515. `KPSE_DEBUG_SEARCH'
  516.      (32). Reports on each file search Kpathsea attempts: the name of
  517.      the file searched for, the path searched in, whether or not the
  518.      file must exist (when drivers search for `cmr10.vf', it need not
  519.      exist), and whether or not we are collecting all occurrences of
  520.      the file in the path (as with, e.g., `texmf.cnf' and
  521.      `texfonts.map'), or just the first (as with most lookups).  This
  522.      can help you correlate what Kpathsea is doing with what is in your
  523.      input file.
  524.   Debugging output from Kpathsea is always written to standard error,
  525. and begins with `kdebug:'. (Except for hash table buckets, which just
  526. start with the number.)
  527. * Menu:
  528. * Logging::            Recording successful searches.
  529. File: kpathsea.info,  Node: Logging,  Up: Debugging
  530. Logging
  531. =======
  532.   Kpathsea can record the time and filename found for each successful
  533. search. This may be useful in finding good candidates for deletion when
  534. your disk is full.
  535.   To do this, define the environment or config file variable
  536. `TEXMFLOG'. The value is the name of the file to append the information
  537. to. The file is created if it doesn't exist.
  538.   Each successful search turns into one line in the log file, with two
  539. words separated by a space. The first word is the time of the search, as
  540. the integer number of seconds since "the epoch", i.e., UTC midnight 1
  541. January 1970 (more precisely, the result of the `time' system call).
  542. The second word is the filename.
  543.   For example, after `setenv TEXMFLOG /tmp/log', running Dvips on
  544. `story.dvi' appends the following lines:
  545.      774455887 /usr/local/lib/texmf/dvips/config.ps
  546.      774455887 /usr/local/lib/texmf/dvips/psfonts.map
  547.      774455888 /usr/local/lib/texmf/dvips/texc.pro
  548.      774455888 /usr/local/lib/texmf/fonts/public/cm/pk/ljfour/cmbx10.600pk
  549.      774455889 /usr/local/lib/texmf/fonts/public/cm/pk/ljfour/cmsl10.600pk
  550.      774455889 /usr/local/lib/texmf/fonts/public/cm/pk/ljfour/cmr10.600pk
  551.      774455889 /usr/local/lib/texmf/dvips/texc.pro
  552. Only filenames that are absolute are recorded, to preserve some
  553. semblance of privacy.
  554. File: kpathsea.info,  Node: Path searching,  Next: TeX searching,  Prev: Debugging,  Up: Top
  555. Path searching
  556. **************
  557.   This chapter describes the generic path searching mechanism Kpathsea
  558. provides. For information about searching for particular file types
  559. (e.g., TeX fonts), see the next chapter.
  560. * Menu:
  561. * Searching overview::        Basic scheme for searching.
  562. * Path sources::        Constructing the search path.
  563. * Default expansion::           a: or :a or a::b expands to a default.
  564. * Variable expansion::          $foo and ${foo} expand to environment values.
  565. * Tilde expansion::             ~ and ~user expand to home directories.
  566. * Subdirectory expansion::    a// and a//b recursively expand to subdirs.
  567. * Filename database::        Using an externally-built list to search.
  568. File: kpathsea.info,  Node: Searching overview,  Next: Path sources,  Up: Path searching
  569. Searching overview
  570. ==================
  571.   A "search path" is a colon-separated list of path elements, which are
  572. directory names with some extra frills. A search path can come from (a
  573. combination of) many sources; see below.  To look up a file `foo' along
  574. a path `.:/dir', Kpathsea checks each element of the path in turn:
  575. first `./foo', then `/dir/foo', (typically) returning the first one
  576. that exists.
  577.   The "colon" and "slash" mentioned here aren't necessarily `:' and `/'
  578. on non-Unix systems. Kpathsea tries to adapt to other operating
  579. systems' conventions.
  580.   To check a path element E, Kpathsea first sees if a prebuilt database
  581. (see below) applies to E, i.e., if the database is in a directory that
  582. is a prefix of E. If so, the path specification is matched against the
  583. contents of the database.
  584.   If the database does not exist, or does not apply to this path
  585. element, contains no matches, the filesystem is searched. Kpathsea
  586. constructs the list of directories that correspond to this path
  587. element, and then checks in them for the file being searched for. (To
  588. help speed future lookups of files in the same directory, the directory
  589. in which a file is found is floated to the top of the directory list.)
  590.   Each path element is checked in turn: first the database, then the
  591. disk. Once a match is found, the searching stops and the result is
  592. returned. This avoids possibly-expensive processing of path
  593. specifications that are never needed on a particular run.
  594.   Although the simplest and most common path element is a directory
  595. name, Kpathsea supports additional features in search paths: layers of
  596. default values, environment variable names, config file values, users'
  597. home directories, and recursive subdirectory searching. Thus, we say
  598. that Kpathsea "expands" a path element, meaning getting rid of all the
  599. magic specifications and getting down to the basic directory name or
  600. names. This process is described in the sections below. It happens in
  601. the same order as the sections.
  602.   Exception to the above: If the filename being searched for is absolute
  603. or explicitly relative, i.e., starts with `/' or `./' or `../',
  604. Kpathsea simply checks if that file exists; it is not looked for along
  605. any paths.
  606. File: kpathsea.info,  Node: Path sources,  Next: Default expansion,  Prev: Searching overview,  Up: Path searching
  607. Path sources
  608. ============
  609.   A search path can come from many sources.  In priority order (meaning
  610. Kpathsea will use whichever it finds first):
  611.   1. A user-set environment variable, e.g., `TEXINPUTS'.
  612.   2. A program-specific configuration file, e.g., an `S /a:/b' line in
  613.      Dvips' `config.ps'.
  614.   3. A line in a Kpathsea configuration file `texmf.cnf', e.g.,
  615.      `TEXINPUTS=/c:/d'. See section below.
  616.   4. The compile-time default (specified in `kpathsea/paths.h').
  617. In any case, once the path specification to use is determined, its
  618. evaluation is independent of its source.  These sources may also be
  619. combined via default expansion. See the next section.
  620.   You can see each of these values for a given search path by using the
  621. debugging options of Kpathsea or your program. *Note Debugging::.
  622. * Menu:
  623. * Config files::        Kpathsea's runtime config files (texmf.cnf).
  624. File: kpathsea.info,  Node: Config files,  Up: Path sources
  625. Config files
  626. ------------
  627.   As mentioned above, Kpathsea reads "runtime configuration files"
  628. named `texmf.cnf' for search path definitions. The path used to search
  629. for them is constructed in the usual way, as described above (except
  630. that configuration files cannot be used to define the path, naturally;
  631. also, an `ls-R' database is not used to search for them, for technical
  632. reasons).
  633.   The environment variable used is `TEXMFCNF'.
  634.   Kpathsea reads *all* `texmf.cnf' files in the search path, not just
  635. the first one found; it uses the first definition of each variable
  636. encountered. Thus, with the (default) search path of `.:$TEXMF', values
  637. from `./texmf.cnf' override those from `$TEXMF/texmf.cnf'.
  638.   Here is the format for `texmf.cnf' files:
  639.    * Anything after a `%' or `#' is ignored; this is for comments.
  640.    * Blank lines are ignored.
  641.    * Each remaining nonblank line must look like
  642.           VARIABLE [. PROGNAME] [=] VALUE
  643.      where the `=' and surrounding whitespace is optional.
  644.    * The VARIABLE name may contain any characters except whitespace,
  645.      `=', or `.' characters, but sticking to `A-Za-z_' is safest.
  646.    * If the `.PROGNAME' is present, the definition only applies if the
  647.      program that is running is named (i.e., the last component of
  648.      `argv[0]') PROGNAME.  This allows (for example) different flavors
  649.      of TeX to have different search paths.
  650.    * The VALUE may contain any characters except whitespace, `%', and
  651.      `@'.  (These restrictions are necessary because of the various
  652.      `sed' and other processing done on `texmf.cnf' at build time.)
  653.    * All definitions are read before anything is expanded, so you can
  654.      use variables before they are defined (like `make', unlike most
  655.      everything else).
  656. Here is the fragment from the distributed file illustrating most of
  657. these points:
  658.      % TeX input files -- i.e., anything to be found by \input or \openin [...]
  659.      latex209_inputs = .:$TEXMF/tex/latex209//:$TEXMF/tex//
  660.      latex2e_inputs = .:$TEXMF/tex/latex2e//:$TEXMF/tex//
  661.      TEXINPUTS = .:$TEXMF/tex//
  662.      TEXINPUTS.latex209 = $latex209_inputs
  663.      TEXINPUTS.latex2e = $latex2e_inputs
  664.      TEXINPUTS.latex = $latex2e_inputs
  665.   Although this format has obvious similarities to Bourne shell
  666. scripts--change the comment character to `#', disallow spaces around
  667. the `=', and get rid of the `.PROGRAM' convention, and it could be run
  668. through the shell. But there seemed little advantage to doing this,
  669. since all the information would have to passed back (with `echo''s,
  670. presumably) to Kpathsea and parsed there anyway, since the `sh' process
  671. couldn't affect its parent's environment.
  672.   The implementation of all this is in `kpathsea/cnf.c'.
  673. File: kpathsea.info,  Node: Default expansion,  Next: Variable expansion,  Prev: Path sources,  Up: Path searching
  674. Default expansion
  675. =================
  676.   If the highest-priority search path (in the list in the previous
  677. section) contains an "extra colon" (i.e., leading, trailing, or
  678. doubled), Kpathsea inserts the next-highest-priority search path that is
  679. set at that point. If that search path has an extra colon, the same
  680. happens with the next-highest. (An extra colon in the compile-time
  681. default value has unpredictable results, and may cause the program to
  682. crash, so installers beware.)
  683.   For example, given
  684.      setenv TEXINPUTS /home/karl:
  685. and a `TEXINPUTS' value from `texmf.cnf' of
  686.      .:$TEXMF//tex
  687. then the final value used for searching will be:
  688.      /home/karl:.:$TEXMF//tex
  689. You can trace this by debugging "paths" (*note Debugging::.).
  690.   Minor technical point: Since it would be useless to insert the default
  691. value in more than one place, Kpathsea changes only one extra `:' and
  692. leaves any others in place (where they will eventually be effectively
  693. equivalent to `.', i.e., the current directory). It checks first for a
  694. leading `:', then a trailing `:', then a doubled `:'.
  695. File: kpathsea.info,  Node: Variable expansion,  Next: Tilde expansion,  Prev: Default expansion,  Up: Path searching
  696. Variable expansion
  697. ==================
  698.   `$foo' or `${foo}' in a path element is replaced by (1) the value of
  699. an environment variable `foo' (if it is set); (2) the value of `foo'
  700. from `texmf.cnf' (if any such exists); (3) the empty string.
  701.   If the character after the `$' is alphanumeric or `_', the variable
  702. name consists of all consecutive such characters. If the character
  703. after the `$' is a `{', the variable name consists of everything up to
  704. the next `}' (braces are not balanced!).  Otherwise, Kpathsea gives a
  705. warning and ignores the `$' and its following character.
  706.   Remember to quote the `$''s and braces as necessary for your shell.
  707.   *Shell* variable values cannot be seen by Kpathsea.
  708.   For example, given
  709.      setenv TEXMF /home/tex
  710.      setenv TEXINPUTS .:$TEXMF:${TEXMF}new
  711. the final `TEXINPUTS' path is the three directories:
  712.      .:/home/tex:/home/texnew
  713. You can trace this by debugging "paths" (*note Debugging::.).
  714. File: kpathsea.info,  Node: Tilde expansion,  Next: Subdirectory expansion,  Prev: Variable expansion,  Up: Path searching
  715. Tilde expansion
  716. ===============
  717.   A leading `~' or `~USER' in a path element is replaced by the current
  718. or USER's home directory, respectively.
  719.   If USER is invalid, or the home directory cannot be determined,
  720. Kpathsea uses `.' instead.
  721.   For example,
  722.      setenv TEXINPUTS ~/mymacros:
  723. will prepend a directory `mymacros' in your home directory to the
  724. default path.
  725. File: kpathsea.info,  Node: Subdirectory expansion,  Next: Filename database,  Prev: Tilde expansion,  Up: Path searching
  726. Subdirectory expansion
  727. ======================
  728.   A `//' in a path element following a directory D is replaced by all
  729. subdirectories of D: first those subdirectories directly under D, then
  730. the subsubdirectories under those, and so on.  At each level, the order
  731. in which the directories are searched is unspecified. (It's "directory
  732. order", and definitely not alphabetical.)
  733.   If you specify any filename components after the `//', only
  734. subdirectories which contain those components are included.  For
  735. example, `/a//b' would expand into directories `/a/1/b', `/a/2/b',
  736. `/a/1/1/b', and so on, but not `/a/b/c' or `/a/1'.
  737.   I should mention one related implementation trick, which I stole from
  738. GNU find.  Matthew Farwell `<dylan@ibmpcug.co.uk>' suggested it, and
  739. David MacKenzie `<djm@gnu.ai.mit.edu>' implemented it (as far as I
  740. know).
  741.   The trick is that in every real Unix implementation (as opposed to the
  742. POSIX specification), a directory which contains no subdirectories will
  743. have exactly two links (namely, one for `.' and one for `..').  That is
  744. to say, the `st_nlink' field in the `stat' structure will be two.
  745. Thus, we don't have to stat everything in the bottom-level (leaf)
  746. directories--we can just check `st_nlink', notice it's two, and do no
  747. more work.
  748.   But if you have a directory that contains *one* subdirectory and five
  749. hundred files, `st_nlink' will be 3, and Kpathsea has to stat every one
  750. of those 501 entries.  Therein lies slowness.
  751.   You can disable the trick by undefining `UNIX_ST_LINK' in
  752. `kpathsea/config.h'. (It is undefined by default except under Unix.)
  753.   Unfortunately, in some cases files in leaf directories are `stat''d:
  754. if the path specification is, say, `$TEXMF/fonts//pk//', then files in
  755. a subdirectory `.../pk', even if it is a leaf, are checked. The reason
  756. cannot be explained without reference to the implementation, so read
  757. `kpathsea/elt-dirs.c' (search for `may descend') if you are curious.
  758. (And if you can find a way to *solve* the problem, please let me know.)
  759. File: kpathsea.info,  Node: Filename database,  Prev: Subdirectory expansion,  Up: Path searching
  760. Filename database (`ls-R')
  761. ==========================
  762.   Kpathsea goes to some lengths to minimize disk accesses for searches
  763. (*note Subdirectory expansion::.).  Nevertheless, at installations with
  764. enough directories, doing a linear search of each possible directory for
  765. a given file can take an excessively long time ("excessive" depending
  766. on the speed of the disk, whether it's NFS-mounted, how patient you are,
  767. etc.). In practice, the union of font directories from the Dvips(k) and
  768. Dviljk distributions is large enough for searching to be noticeably slow
  769. on typical machines these days.
  770.   Therefore, Kpathsea can use an externally-built "database" that maps
  771. files to directories, thus avoiding the need to exhaustively search the
  772. disk.  By fiat, you must name the file `ls-R', and put it at the root
  773. of the TeX installation hierarchy (`$TEXMF' by default).  Kpathsea does
  774. variable expansion on the `$TEXMF', naturally, so you can use different
  775. `ls-R''s for different trees, if you are testing new ones.  However,
  776. one and only one `ls-R' is read; it is not searched for along any paths.
  777.   You can build `ls-R' with the command
  778.      ls -R /YOUR/ROOT/DIR >ls-R
  779.    if your `ls' produces the right output format (see the section
  780. below). GNU `ls', for example, outputs in this format.  It is probably
  781. best to do this via `cron', so changes in the installed files will be
  782. automatically reflected (albeit with some delay) in the database.
  783. If your system uses symbolic links, the command `ls -LR' will be more
  784. reliable than plain `ls -R'.  The former follows the symbolic links to
  785. the real files, which is what Kpathsea needs.
  786.   Kpathsea warns you if it finds an `ls-R' file, but the file does not
  787. contain any usable entries. The usual culprit is using just `ls -R' to
  788. generate the `ls-R' file instead of `ls -R /YOUR/DIR'.  Kpathsea looks
  789. for lines starting with `/', to improve reliability with unusual
  790. filenames (specifically, those ending with a `:').
  791.   Because the database may be out-of-date for a particular run (e.g.,
  792. if a font was just built with `MakeTeXPK'), if a file is not found in
  793. the database, by default Kpathsea goes ahead and searches the disk. If a
  794. particular path element begins with `!!', however, *only* the database
  795. will be searched for that element, never the disk. If the database does
  796. not exist, nothing will be searched. Because this can greatly surprise
  797. users ("I see the font `foo.tfm' when I do an `ls'; why can't Dvips
  798. find it?"), I do not recommend using this feature.
  799. * Menu:
  800. * Database format::        Syntax details of the database file.
  801. File: kpathsea.info,  Node: Database format,  Up: Filename database
  802. Database format
  803. ---------------
  804.   The "database" read by Kpathsea is a line-oriented file of plain
  805. text. The format is that generated by GNU (and perhaps other) `ls'
  806. programs given the `-R' option, as follows.
  807.    * Blank lines are ignored.
  808.    * If a line begins with `/' and ends with a colon, it's the name of a
  809.      directory.
  810.    * All other lines name entries in the most recently seen directory.
  811.      `/''s in such lines will produce possibly-strange results.
  812.    * Files with no preceding directory line are ignored.
  813.   For example, here's the first few lines of `ls-R' on my system:
  814.      bibtex
  815.      dvips
  816.      fonts
  817.      ini
  818.      ls-R
  819.      mf
  820.      tex
  821.      
  822.      /usr/local/lib/texmf/bibtex:
  823.      bib
  824.      bst
  825.      doc
  826.      
  827.      /usr/local/lib/texmf/bibtex/bib:
  828.      asi.bib
  829.      bibshare
  830.      btxdoc.bib
  831. On my system, `ls-R' is about 30K bytes.
  832. File: kpathsea.info,  Node: TeX searching,  Next: TeX directory structure,  Prev: Path searching,  Up: Top
  833. TeX searching
  834. *************
  835.   Although the basic features in Kpathsea can be used for any type of
  836. path searching, it came about (like all libraries) with a specific
  837. application in mind: I wrote Kpathsea specifically for TeX system
  838. programs.  I had been struggling with the programs I was using (Dvips,
  839. Xdvi, and TeX itself) having slightly different notions of how to
  840. specify paths; and debugging was painful, since no code was shared.
  841.   Therefore, Kpathsea provides some TeX-specific features.  Indeed,
  842. many of the supposedly generic path searching features were provided
  843. because they seemed useful in that conTeXt (font lookup, particularly).
  844. * Menu:
  845. * Envvars: TeX environment variables.    Overriding compiled-in paths.
  846. * Glyph lookup::            Searching for bitmap fonts.
  847. File: kpathsea.info,  Node: TeX environment variables,  Next: Glyph lookup,  Up: TeX searching
  848. TeX environment variables
  849. =========================
  850.   Kpathsea defines a sequence of environment variables to search for
  851. each file type it supports.  This makes it easy for different programs
  852. to check the same environment variables, in the same order.
  853.   The following table lists the environment variables searched for each
  854. file type in the order they are searched (and a brief description of the
  855. file type).  That is, only if the first variable is unset is the second
  856. variable checked, and so on.  If none are set, various other things are
  857. checked; *note Path sources::..
  858. `.base'
  859.      (Metafont memory dump) `MFBASES'
  860. `.bib'
  861.      (BibTeX bibliography source) `BIBINPUTS'
  862. `.bst'
  863.      (BibTeX style file) `BSTINPUTS', `TEXINPUTS'
  864. `.cnf'
  865.      (Kpathsea runtime configuration files) `TEXMFCNF'
  866. `.eps'
  867.      (Encapsulated PostScript figures) `TEXPICTS', `TEXINPUTS'
  868. `.fmt'
  869.      (TeX memory dump) `TEXFORMATS'
  870.      (generic font bitmap) `PROGRAMFONTS', `GFFONTS', `GLYPHFONTS',
  871.      `TEXFONTS'
  872. `.mf'
  873.      (Metafont source) `MFINPUTS'
  874. `mf.pool'
  875.      (Metafont program strings) `MFPOOL'
  876. `.pict'
  877.      (Other kinds of figures) Same as `.eps'.
  878.      (packed bitmap font) `PROGRAMFONTS', `PKFONTS', `TEXPKS',
  879.      `GLYPHFONTS', `TEXFONTS'
  880. `.tex'
  881.      (TeX source) `TEXINPUTS'
  882. `tex.pool'
  883.      (TeX program strings) `TEXPOOL'
  884. `.tfm'
  885.      (TeX font metrics) `TFMFONTS', `TEXFONTS'
  886. `.vf'
  887.      (virtual font) `VFFONTS', `TEXFONTS'
  888.   For the font variables, the intent is that:
  889.   1. `TEXFONTS' is the default for everything.
  890.   2. `GLYPHFONTS' is the default for bitmap (or, more precisely,
  891.      non-metric) files.
  892.   3. Each format has its own variable.
  893.   4. Each program can and should have its own font override path as
  894.      well; e.g., `DVIPSFONTS' for Dvipsk. Again, this is for bitmaps,
  895.      not metrics.
  896.   If these environment variables are set, the corresponding `texmf.cnf'
  897. definition won't be looked at (unless, as usual, the environment
  898. variable has an extra `:'). *Note Default expansion::.
  899. File: kpathsea.info,  Node: Glyph lookup,  Prev: TeX environment variables,  Up: TeX searching
  900. Glyph lookup
  901. ============
  902.   Kpathsea provides a routine (`kpse_find_glyph_format' in
  903. `kpathsea/tex-glyph.c') which searches for a bitmap font in GF or PK
  904. format (or either) given a font name (e.g., `cmr10') and a resolution
  905. (e.g., 300).
  906.   The search is based solely on filenames, not file contents--if a PK
  907. file is named `cmr10.300gf', it will be found as a GF file.
  908.   Here is an outline of the search strategy (details in the sections
  909. below) for a file NAME at resolution DPI.  The search stops at the
  910. first successful lookup.
  911.   1. Look for an existing file NAME.DPI in the specified format(s).
  912.   2. If NAME is an alias for a file F in the fontmap file
  913.      `texfonts.map', look for F.DPI.
  914.   3. Run an external script (typically named `MakeTeXPK') to generate
  915.      the font.
  916.   4. Look for FALLBACK.DPI, where FALLBACK is some last-resort font
  917.      (typically `cmr10').
  918. * Menu:
  919. * Basic glyph lookup::        Features common to all glyph lookups.
  920. * Fontmap::            Aliases for fonts.
  921. * MakeTeX... scripts::        Creating files on the fly.
  922. * Fallback font::        Resolutions and fonts of last resort.
  923.