home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / octave-1.1.1p1-base.tgz / octave-1.1.1p1-base.tar / fsf / octave / kpathsea / tex-file.h < prev    next >
C/C++ Source or Header  |  1994-03-13  |  6KB  |  154 lines

  1. /* tex-file.h: declarations for all TeX font formats.
  2.  
  3. Copyright (C) 1993, 94 Karl Berry.
  4.  
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2, or (at your option)
  8. any later version.
  9.  
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. GNU General Public License for more details.
  14.  
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  18.  
  19. #ifndef KPATHSEA_TEX_FILE_H
  20. #define KPATHSEA_TEX_FILE_H
  21.  
  22. #include <kpathsea/c-proto.h>
  23. #include <kpathsea/default.h>
  24. #include <kpathsea/init-path.h>
  25. #include <kpathsea/paths.h>
  26. #include <kpathsea/types.h>
  27.  
  28.  
  29. /* If non-NULL, try looking for this if can't find the real font.  */
  30. extern const_string kpse_fallback_font;
  31.  
  32.  
  33. /* If non-NULL, check these if can't find (within a few percent of) the
  34.    given resolution.  List must end with a zero element.  */
  35. extern unsigned *kpse_fallback_resolutions;
  36.  
  37. /* This initializes the fallback resolution list.  If ENVVAR
  38.    is set, it is used; otherwise, the envvar `TEXSIZES' is looked at; if
  39.    that's not set either, a compile-time default is used.  */
  40. extern void kpse_init_fallback_resolutions P1H(string envvar);
  41.  
  42.  
  43. /* If non-null, used instead of the usual envvar/path defaults, e.g.,
  44.    set to `getenv ("XDVIFONTS")'.  */
  45. extern string kpse_font_override_path;
  46.  
  47. /* We put the glyphs first so we don't waste space in an array.  A new
  48.    format here should be accompanied by a new initialization
  49.    abbreviation below and a new entry in `tex-make.c'.  */
  50. typedef enum
  51. {
  52.   kpse_gf_format,
  53.   kpse_pk_format,
  54.   kpse_any_glyph_format, /* ``any'' meaning any of the above */
  55.   kpse_bib_format, 
  56.   kpse_bst_format, 
  57.   kpse_mf_format, 
  58.   kpse_tex_format, 
  59.   kpse_tfm_format, 
  60.   kpse_vf_format
  61. } kpse_file_format_type;
  62.  
  63.  
  64. /* Abbreviate what we're going to do a million times.  */
  65. #define KPSE_FONT_PATH(def, envs) (kpse_font_override_path \
  66.   ? kpse_expand_default (kpse_font_override_path, def) \
  67.   : kpse_init_path (NULL, def, envs, NULL))
  68. #define KPSE_NONFONT_PATH(def, envs) kpse_init_path (NULL, def, envs, NULL)
  69.  
  70. /* Do initialization for the various file formats.  We separate the
  71.    envvar lists so they can be used in other contexts with a different
  72.    default, as in dvipsk (until we have config file support).  */
  73. #define KPSE_BASE_ENVS "MFBASES"
  74. #define KPSE_BASE_PATH() KPSE_NONFONT_PATH (DEFAULT_BASE_PATH, KPSE_BASE_ENVS)
  75.  
  76. #define KPSE_BIB_ENVS "BIBINPUTS"
  77. #define KPSE_BIB_PATH() KPSE_NONFONT_PATH (DEFAULT_BIB_PATH, KPSE_BIB_ENVS)
  78.  
  79. #define KPSE_BST_ENVS "BSTINPUTS", "TEXINPUTS"
  80. #define KPSE_BST_PATH() KPSE_NONFONT_PATH (DEFAULT_BST_PATH, KPSE_BST_ENVS)
  81.  
  82. #define KPSE_FMT_ENVS "TEXFORMATS"
  83. #define KPSE_FMT_PATH() KPSE_NONFONT_PATH (DEFAULT_FMT_PATH, KPSE_FMT_ENVS)
  84.  
  85. #define KPSE_GF_ENVS "GFFONTS", KPSE_GLYPH_ENVS
  86. #define KPSE_GF_PATH() KPSE_FONT_PATH (DEFAULT_GF_PATH, KPSE_GF_ENVS)
  87.  
  88. #define KPSE_GLYPH_ENVS "GLYPHFONTS", "TEXFONTS"
  89. #define KPSE_GLYPH_PATH() KPSE_FONT_PATH (DEFAULT_GLYPH_PATH, KPSE_GLYPH_ENVS)
  90.  
  91. #define KPSE_MF_ENVS "MFINPUTS"
  92. #define KPSE_MF_PATH() KPSE_NONFONT_PATH (DEFAULT_MF_PATH, KPSE_MF_ENVS)
  93.  
  94. #define KPSE_MFPOOL_ENVS "MFPOOL"
  95. #define KPSE_MFPOOL_PATH() \
  96.   KPSE_NONFONT_PATH (DEFAULT_MFPOOL_PATH, KPSE_MFPOOL_ENVS)
  97.  
  98. #define KPSE_PK_ENVS "PKFONTS", "TEXPKS", KPSE_GLYPH_ENVS
  99. #define KPSE_PK_PATH() KPSE_FONT_PATH (DEFAULT_PK_PATH, KPSE_PK_ENVS)
  100.  
  101. #define KPSE_TEX_ENVS "TEXINPUTS"
  102. #define KPSE_TEX_PATH() KPSE_NONFONT_PATH (DEFAULT_TEX_PATH, KPSE_TEX_ENVS)
  103.  
  104. #define KPSE_TEXPOOL_ENVS "TEXPOOL"
  105. #define KPSE_TEXPOOL_PATH() \
  106.   KPSE_NONFONT_PATH (DEFAULT_TEXPOOL_PATH, KPSE_TEXPOOL_ENVS)
  107.  
  108. #define KPSE_TFM_ENVS "TFMFONTS", "TEXFONTS"
  109. #define KPSE_TFM_PATH() KPSE_FONT_PATH (DEFAULT_TFM_PATH, KPSE_TFM_ENVS)
  110.  
  111. #define KPSE_VF_ENVS "VFFONTS", "TEXFONTS"
  112. #define KPSE_VF_PATH() KPSE_FONT_PATH (DEFAULT_VF_PATH, KPSE_VF_ENVS)
  113.  
  114. /* This type describes a glyph font that we have found.  Maybe it would work
  115.    for all kinds of fonts, and other files.  */
  116.  
  117. typedef enum
  118. {
  119.   kpse_source_normal,  /* the searched-for font: already existed */
  120.   kpse_source_alias,   /* : was an alias for an existing file */
  121.   kpse_source_maketex, /* : was created on the fly */
  122.   kpse_source_fallback /* : wasn't found, but the fallback font was */
  123. } kpse_source_type;
  124.  
  125. typedef struct
  126. {
  127.   string name;            /* font name found */
  128.   unsigned dpi;            /* size found, for glyphs */
  129.   kpse_file_format_type format;    /* glyph format found */
  130.   kpse_source_type source;    /* where we found it */
  131. } kpse_font_file_type;        
  132.  
  133. #define KPSE_FONT_FILE_NAME(f) ((f).name)
  134. #define KPSE_FONT_FILE_DPI(f) ((f).dpi)
  135. #define KPSE_FONT_FILE_FORMAT(f) ((f).format)
  136. #define KPSE_FONT_FILE_SOURCE(f) ((f).source)
  137.  
  138.  
  139. /* Concatenate NAME "." EXT and call `kpse_path_search' with the result
  140.    and the other arguments.  */
  141. extern string kpse_find_file P4H(const_string name, const_string ext,
  142.                                  const_string path, boolean must_exist);
  143.  
  144. /* Here are the file formats we actually look up like this, so far.  We
  145.    do call init_path every time, which is bad.  The saving grace is that
  146.    the actual filesystem lookups are only done once (if at all), because
  147.    we cache the results (per path element). Still not very clean, though.
  148.    
  149.    xdvik uses kpse_find_vf, and dviljk uses kpse_find_tfm. */
  150. #define kpse_find_tfm(name) kpse_find_file (name, "tfm", KPSE_TFM_PATH (),true)
  151. #define kpse_find_vf(name) kpse_find_file (name, "vf", KPSE_VF_PATH (), false)
  152.  
  153. #endif /* not KPATHSEA_TEX_FILE_H */
  154.