Back to index

tetex-bin  3.0
tex-glyph.h
Go to the documentation of this file.
00001 /* tex-glyph.h: look for a TeX glyph font (GF or PK).
00002 
00003 Copyright (C) 1993 Karl Berry.
00004 
00005 This library is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU Library General Public
00007 License as published by the Free Software Foundation; either
00008 version 2 of the License, or (at your option) any later version.
00009 
00010 This library is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 Library General Public License for more details.
00014 
00015 You should have received a copy of the GNU Library General Public
00016 License along with this library; if not, write to the Free Software
00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
00018 
00019 #ifndef KPATHSEA_TEX_GLYPH_H
00020 #define KPATHSEA_TEX_GLYPH_H
00021 
00022 #include <kpathsea/tex-file.h>
00023 
00024 
00025 /* This type describes the origination of a glyph font.  */
00026 
00027 typedef enum
00028 {
00029   kpse_glyph_source_normal,  /* the searched-for font: already existed */
00030   kpse_glyph_source_alias,   /* : was an alias for an existing file */
00031   kpse_glyph_source_maketex, /* : was created on the fly */
00032   kpse_glyph_source_fallback /* : wasn't found, but the fallback font was */
00033 } kpse_glyph_source_type;
00034 
00035 
00036 typedef struct
00037 {
00038   string name;                     /* font name found */
00039   unsigned dpi;                    /* size found, for glyphs */
00040   kpse_file_format_type format;    /* glyph format found */
00041   kpse_glyph_source_type source;   /* where we found it */
00042 } kpse_glyph_file_type;            
00043 
00044 #define KPSE_GLYPH_FILE_NAME(f) ((f).name)
00045 #define KPSE_GLYPH_FILE_DPI(f) ((f).dpi)
00046 #define KPSE_GLYPH_FILE_FORMAT(f) ((f).format)
00047 #define KPSE_GLYPH_FILE_SOURCE(f) ((f).source)
00048 
00049 
00050 /* Search first for the font named FONT_NAME at resolution DPI in the
00051    glyph format FORMAT (see `try_size' for details of format searching).
00052    Then try resolutions within KPSE_BITMAP_TOLERANCE of DPI.  Then try
00053    the resolutions in `kpse_fallback_sizes', then within the tolerance
00054    of each of those.  Then if FONT_NAME is an alias defined in a
00055    texfonts.map do all the above for its real name.  Then try the above
00056    for kpse_fallback_name.  Then fail.  Return either the filename
00057    found, or NULL.  Also return information about the file found in
00058    *GLYPH_FILE.  */
00059 extern KPSEDLL string kpse_find_glyph P4H(const_string font_name, unsigned dpi, 
00060                                   kpse_file_format_type format,
00061                                   kpse_glyph_file_type *glyph_file);
00062 
00063 /* Look for a specific format only.  */
00064 #define kpse_find_pk(font_name, dpi, glyph_file) \
00065   kpse_find_glyph (font_name, dpi, kpse_pk_format, glyph_file)
00066 #define kpse_find_gf(font_name, dpi, glyph_file) \
00067   kpse_find_glyph (font_name, dpi, kpse_gf_format, glyph_file)
00068 
00069 
00070 /* Defines how far away a pixel file can be found from its stated size.
00071    The DVI standard says any resolution within 0.2% of the stated size
00072    is ok, but we are more forgiving.  */
00073 #define KPSE_BITMAP_TOLERANCE(r) ((r) / 500.0 + 1)
00074 
00075 /* Check whether DPI1 is within KPSE_BITMAP_TOLERANCE of DPI2. */
00076 extern KPSEDLL boolean kpse_bitmap_tolerance P2H(double dpi1, double dpi2);
00077 
00078 #endif /* not KPATHSEA_TEX_GLYPH_H */