beta-0.89.2
[luatex.git] / source / texk / kpathsea / proginit.c
blob265b5ebb05230a0a1f00502babbe8d5e765b5f16
1 /* proginit.c: useful initializations for DVI drivers.
3 Copyright 1994, 1995, 1996, 2008 Karl Berry.
4 Copyright 1997, 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 #include <kpathsea/config.h>
20 #include <kpathsea/c-pathch.h>
21 #include <kpathsea/proginit.h>
22 #include <kpathsea/tex-file.h>
25 /* These initializations were common to all the drivers modified for
26 kpathsea, so a single routine seemed in order. Kind of a bollixed-up
27 mess, but still better than repeating the code. */
29 void
30 kpathsea_init_prog (kpathsea kpse, const_string prefix, unsigned dpi,
31 const_string mode, const_string fallback)
33 string font_var = concat (prefix, "FONTS");
34 string header_var = concat (prefix, "HEADERS");
35 string makepk_var = concat (prefix, "MAKEPK");
36 string size_var = concat (prefix, "SIZES");
38 /* Do both `pk_format' and `any_glyph_format' for the sake of xdvi; in
39 general, mktexpk might apply to either, and the program will ask
40 for the one it wants. */
42 /* Might have a program-specific name for mktexpk itself. */
43 if (getenv (makepk_var)) {
44 /* If we did, we want to enable the program, I think. */
45 kpathsea_set_program_enabled (kpse, kpse_pk_format, 1, kpse_src_env);
46 kpathsea_set_program_enabled (kpse, kpse_any_glyph_format, 1,kpse_src_env);
48 kpse->format_info[kpse_pk_format].program
49 = kpse->format_info[kpse_any_glyph_format].program
50 = getenv (makepk_var);
53 /* A couple font paths have traditionally had application-specific
54 environment variables to override all else; namely, XDVIFONTS and
55 DVIPSHEADERS. So set those if we have them. */
56 kpse->format_info[kpse_pk_format].override_path
57 = kpse->format_info[kpse_gf_format].override_path
58 = kpse->format_info[kpse_any_glyph_format].override_path
59 = kpse->format_info[kpse_tfm_format].override_path
60 = getenv (font_var);
62 kpse->format_info[kpse_tex_ps_header_format].override_path
63 = getenv (header_var);
65 kpathsea_init_fallback_resolutions (kpse, size_var);
66 kpathsea_xputenv_int (kpse, "MAKETEX_BASE_DPI", dpi);
67 kpse->fallback_font = fallback;
69 /* Ugliness. See comments in kpse_make_tex in kpathsea/tex-make.c. */
70 kpathsea_xputenv (kpse, "MAKETEX_MODE", mode ? mode : DIR_SEP_STRING);
72 free (font_var);
73 free (header_var);
74 free (makepk_var);
75 free (size_var);
78 #if defined (KPSE_COMPAT_API)
79 void
80 kpse_init_prog (const_string prefix, unsigned dpi,
81 const_string mode, const_string fallback)
83 kpathsea_init_prog(kpse_def,prefix,dpi,mode,fallback);
85 #endif