beta-0.89.2
[luatex.git] / source / texk / kpathsea / tex-glyph.h
blob0864bb354237e167974cfc51cf721533dd65f6a3
1 /* tex-glyph.h: look for a TeX glyph font (GF or PK).
3 Copyright 1993, 2008, 2009, 2011 Karl Berry.
4 Copyright 1999, 2005 Olaf Weber.
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 License
17 along with this library; if not, see <http://www.gnu.org/licenses/>. */
19 #ifndef KPATHSEA_TEX_GLYPH_H
20 #define KPATHSEA_TEX_GLYPH_H
22 #include <kpathsea/tex-file.h>
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
29 /* This type describes the origination of a glyph font. */
31 typedef enum
33 kpse_glyph_source_normal, /* the searched-for font: already existed */
34 kpse_glyph_source_alias, /* : was an alias for an existing file */
35 kpse_glyph_source_maketex, /* : was created on the fly */
36 kpse_glyph_source_fallback /* : wasn't found, but the fallback font was */
37 } kpse_glyph_source_type;
40 typedef struct
42 const_string name; /* font name found */
43 unsigned dpi; /* size found, for glyphs */
44 kpse_file_format_type format; /* glyph format found */
45 kpse_glyph_source_type source; /* where we found it */
46 } kpse_glyph_file_type;
48 #define KPSE_GLYPH_FILE_NAME(f) ((f).name)
49 #define KPSE_GLYPH_FILE_DPI(f) ((f).dpi)
50 #define KPSE_GLYPH_FILE_FORMAT(f) ((f).format)
51 #define KPSE_GLYPH_FILE_SOURCE(f) ((f).source)
54 /* Search first for the font named FONT_NAME at resolution DPI in the
55 glyph format FORMAT (see `try_size' for details of format searching).
56 Then try resolutions within KPSE_BITMAP_TOLERANCE of DPI. Then if
57 FONT_NAME is an alias defined in a texfonts.map do all the above for
58 its real name. If not an alias, try creating it on the fly with
59 mktexpk. Then try the resolutions in `kpse_fallback_sizes', then
60 within the tolerance of each of those. Then try the above for
61 kpse_fallback_name. Then fail. Return either the filename found, or
62 NULL. Also return information about the file found in
63 *GLYPH_FILE. */
64 extern KPSEDLL string kpathsea_find_glyph (kpathsea kpse,
65 const_string font_name, unsigned dpi,
66 kpse_file_format_type format,
67 kpse_glyph_file_type *glyph_file);
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)
75 /* Check whether DPI1 is within KPSE_BITMAP_TOLERANCE of DPI2. */
76 extern KPSEDLL boolean kpathsea_bitmap_tolerance (kpathsea kpse,
77 double dpi1, double dpi2);
80 #if defined (KPSE_COMPAT_API)
81 extern KPSEDLL string kpse_find_glyph (const_string font_name, unsigned dpi,
82 kpse_file_format_type format,
83 kpse_glyph_file_type *glyph_file);
85 /* Look for a specific format only. */
86 #define kpse_find_pk(font_name, dpi, glyph_file) \
87 kpse_find_glyph (font_name, dpi, kpse_pk_format, glyph_file)
88 #define kpse_find_gf(font_name, dpi, glyph_file) \
89 kpse_find_glyph (font_name, dpi, kpse_gf_format, glyph_file)
91 extern KPSEDLL boolean kpse_bitmap_tolerance (double dpi1, double dpi2);
92 #endif
94 #ifdef __cplusplus
96 #endif
98 #endif /* not KPATHSEA_TEX_GLYPH_H */