2999
|
1 /* proginit.c: useful initializations for DVI drivers. |
|
2 |
|
3 Copyright (C) 1994, 95, 96 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 #include <kpathsea/config.h> |
|
20 #include <kpathsea/c-pathch.h> |
|
21 #include <kpathsea/proginit.h> |
|
22 #include <kpathsea/tex-file.h> |
|
23 |
|
24 |
|
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. */ |
|
28 |
|
29 void |
|
30 kpse_init_prog P4C(const_string, prefix, unsigned, dpi, const_string, mode, |
|
31 const_string, fallback) |
|
32 { |
|
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"); |
|
37 |
|
38 /* Do both `pk_format' and `any_glyph_format' for the sake of xdvi; in |
3172
|
39 general, mktexpk might apply to either, and the program will ask |
2999
|
40 for the one it wants. */ |
|
41 |
3172
|
42 /* Might have a program-specific name for mktexpk itself. */ |
2999
|
43 if (getenv (makepk_var)) { |
|
44 /* If we did, we want to enable the program, I think. */ |
|
45 kpse_set_program_enabled (kpse_pk_format, 1, kpse_src_env); |
|
46 kpse_set_program_enabled (kpse_any_glyph_format, 1, kpse_src_env); |
|
47 |
|
48 kpse_format_info[kpse_pk_format].program |
|
49 = kpse_format_info[kpse_any_glyph_format].program |
|
50 = getenv (makepk_var); |
|
51 } |
|
52 |
|
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); |
|
61 |
|
62 kpse_format_info[kpse_tex_ps_header_format].override_path |
|
63 = getenv (header_var); |
|
64 |
|
65 kpse_init_fallback_resolutions (size_var); |
|
66 xputenv_int ("MAKETEX_BASE_DPI", dpi); |
|
67 kpse_fallback_font = fallback; |
|
68 |
|
69 /* Ugliness. See comments in kpse_make_tex in kpathsea/tex-make.c. */ |
|
70 xputenv ("MAKETEX_MODE", mode ? mode : DIR_SEP_STRING); |
|
71 |
|
72 free (font_var); |
|
73 free (header_var); |
|
74 free (makepk_var); |
|
75 free (size_var); |
|
76 } |