1 /* tex-glyph.h: look for a TeX glyph font (GF or PK).
3 Copyright 1999, 2005 Olaf Weber.
4 Copyright 1993 Karl Berry.
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef KPATHSEA_TEX_GLYPH_H
23 #define KPATHSEA_TEX_GLYPH_H
25 #include <kpathsea/tex-file.h>
28 /* This type describes the origination of a glyph font. */
32 kpse_glyph_source_normal, /* the searched-for font: already existed */
33 kpse_glyph_source_alias, /* : was an alias for an existing file */
34 kpse_glyph_source_maketex, /* : was created on the fly */
35 kpse_glyph_source_fallback /* : wasn't found, but the fallback font was */
36 } kpse_glyph_source_type;
41 string name; /* font name found */
42 unsigned dpi; /* size found, for glyphs */
43 kpse_file_format_type format; /* glyph format found */
44 kpse_glyph_source_type source; /* where we found it */
45 } kpse_glyph_file_type;
47 #define KPSE_GLYPH_FILE_NAME(f) ((f).name)
48 #define KPSE_GLYPH_FILE_DPI(f) ((f).dpi)
49 #define KPSE_GLYPH_FILE_FORMAT(f) ((f).format)
50 #define KPSE_GLYPH_FILE_SOURCE(f) ((f).source)
53 /* Search first for the font named FONT_NAME at resolution DPI in the
54 glyph format FORMAT (see `try_size' for details of format searching).
55 Then try resolutions within KPSE_BITMAP_TOLERANCE of DPI. Then try
56 the resolutions in `kpse_fallback_sizes', then within the tolerance
57 of each of those. Then if FONT_NAME is an alias defined in a
58 texfonts.map do all the above for its real name. Then try the above
59 for kpse_fallback_name. Then fail. Return either the filename
60 found, or NULL. Also return information about the file found in
62 extern KPSEDLL string kpse_find_glyph P4H(const_string font_name, unsigned dpi,
63 kpse_file_format_type format,
64 kpse_glyph_file_type *glyph_file);
66 /* Look for a specific format only. */
67 #define kpse_find_pk(font_name, dpi, glyph_file) \
68 kpse_find_glyph (font_name, dpi, kpse_pk_format, glyph_file)
69 #define kpse_find_gf(font_name, dpi, glyph_file) \
70 kpse_find_glyph (font_name, dpi, kpse_gf_format, glyph_file)
73 /* Defines how far away a pixel file can be found from its stated size.
74 The DVI standard says any resolution within 0.2% of the stated size
75 is ok, but we are more forgiving. */
76 #define KPSE_BITMAP_TOLERANCE(r) ((r) / 500.0 + 1)
78 /* Check whether DPI1 is within KPSE_BITMAP_TOLERANCE of DPI2. */
79 extern KPSEDLL boolean kpse_bitmap_tolerance P2H(double dpi1, double dpi2);
81 #endif /* not KPATHSEA_TEX_GLYPH_H */