home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21fs.zip / octave / kpathsea / tex-glyph.h < prev    next >
C/C++ Source or Header  |  2000-01-15  |  3KB  |  79 lines

  1. /* tex-glyph.h: look for a TeX glyph font (GF or PK).
  2.  
  3. Copyright (C) 1993 Karl Berry.
  4.  
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Library General Public
  7. License as published by the Free Software Foundation; either
  8. version 2 of the License, or (at your option) any later version.
  9.  
  10. This library 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 GNU
  13. Library General Public License for more details.
  14.  
  15. You should have received a copy of the GNU Library General Public
  16. License along with this library; if not, write to the Free Software
  17. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
  18.  
  19. #ifndef KPATHSEA_TEX_GLYPH_H
  20. #define KPATHSEA_TEX_GLYPH_H
  21.  
  22. #include <kpathsea/tex-file.h>
  23.  
  24.  
  25. /* This type describes the origination of a glyph font.  */
  26.  
  27. typedef enum
  28. {
  29.   kpse_glyph_source_normal,  /* the searched-for font: already existed */
  30.   kpse_glyph_source_alias,   /* : was an alias for an existing file */
  31.   kpse_glyph_source_maketex, /* : was created on the fly */
  32.   kpse_glyph_source_fallback /* : wasn't found, but the fallback font was */
  33. } kpse_glyph_source_type;
  34.  
  35.  
  36. typedef struct
  37. {
  38.   string name;            /* font name found */
  39.   unsigned dpi;            /* size found, for glyphs */
  40.   kpse_file_format_type format;    /* glyph format found */
  41.   kpse_glyph_source_type source;    /* where we found it */
  42. } kpse_glyph_file_type;        
  43.  
  44. #define KPSE_GLYPH_FILE_NAME(f) ((f).name)
  45. #define KPSE_GLYPH_FILE_DPI(f) ((f).dpi)
  46. #define KPSE_GLYPH_FILE_FORMAT(f) ((f).format)
  47. #define KPSE_GLYPH_FILE_SOURCE(f) ((f).source)
  48.  
  49.  
  50. /* Search first for the font named FONT_NAME at resolution DPI in the
  51.    glyph format FORMAT (see `try_size' for details of format searching).
  52.    Then try resolutions within KPSE_BITMAP_TOLERANCE of DPI.  Then try
  53.    the resolutions in `kpse_fallback_sizes', then within the tolerance
  54.    of each of those.  Then if FONT_NAME is an alias defined in a
  55.    texfonts.map do all the above for its real name.  Then try the above
  56.    for kpse_fallback_name.  Then fail.  Return either the filename
  57.    found, or NULL.  Also return information about the file found in
  58.    *GLYPH_FILE.  */
  59. extern string kpse_find_glyph P4H(const_string font_name, unsigned dpi, 
  60.                                   kpse_file_format_type format,
  61.                                   kpse_glyph_file_type *glyph_file);
  62.  
  63. /* Look for a specific format only.  */
  64. #define kpse_find_pk(font_name, dpi, glyph_file) \
  65.   kpse_find_glyph (font_name, dpi, kpse_pk_format, glyph_file)
  66. #define kpse_find_gf(font_name, dpi, glyph_file) \
  67.   kpse_find_glyph (font_name, dpi, kpse_gf_format, glyph_file)
  68.  
  69.  
  70. /* Defines how far away a pixel file can be found from its stated size.
  71.    The DVI standard says any resolution within 0.2% of the stated size
  72.    is ok, but we are more forgiving.  */
  73. #define KPSE_BITMAP_TOLERANCE(r) ((r) / 500.0 + 1)
  74.  
  75. /* Check whether DPI1 is within KPSE_BITMAP_TOLERANCE of DPI2. */
  76. extern boolean kpse_bitmap_tolerance P2H(double dpi1, double dpi2);
  77.  
  78. #endif /* not KPATHSEA_TEX_GLYPH_H */
  79.