void kpse_init_prog P4C(const_string, prefix, unsigned, dpi, const_string, mode, const_string, fallback) { string font_var = concat (prefix, "FONTS"); string header_var = concat (prefix, "HEADERS"); string makepk_var = concat (prefix, "MAKEPK"); string size_var = concat (prefix, "SIZES"); /* Do both `pk_format' and `any_glyph_format' for the sake of xdvi; in general, mktexpk might apply to either, and the program will ask for the one it wants. */ /* Might have a program-specific name for mktexpk itself. */ if (getenv (makepk_var)) { /* If we did, we want to enable the program, I think. */ kpse_set_program_enabled (kpse_pk_format, 1, kpse_src_env); kpse_set_program_enabled (kpse_any_glyph_format, 1, kpse_src_env); kpse_format_info[kpse_pk_format].program = kpse_format_info[kpse_any_glyph_format].program = getenv (makepk_var); } /* A couple font paths have traditionally had application-specific environment variables to override all else; namely, XDVIFONTS and DVIPSHEADERS. So set those if we have them. */ kpse_format_info[kpse_pk_format].override_path = kpse_format_info[kpse_gf_format].override_path = kpse_format_info[kpse_any_glyph_format].override_path = kpse_format_info[kpse_tfm_format].override_path = getenv (font_var); kpse_format_info[kpse_tex_ps_header_format].override_path = getenv (header_var); kpse_init_fallback_resolutions (size_var); xputenv_int ("MAKETEX_BASE_DPI", dpi); kpse_fallback_font = fallback; /* Ugliness. See comments in kpse_make_tex in kpathsea/tex-make.c. */ xputenv ("MAKETEX_MODE", mode ? mode : DIR_SEP_STRING); free (font_var); free (header_var); free (makepk_var); free (size_var); }
int main () { test_find_glyph ("/usr/local/lib/tex/fonts/cm/cmr10", 300); /* absolute */ test_find_glyph ("cmr10", 300); /* normal */ test_find_glyph ("logo10", 300); /* find gf */ test_find_glyph ("cmr10", 299); /* find 300 */ test_find_glyph ("circle10", 300); /* in fontmap */ test_find_glyph ("none", 300); /* do not find */ kpse_fallback_font = "cmr10"; test_find_glyph ("fallback", 300); /* find fallback font cmr10 */ kpse_init_fallback_resolutions ("KPATHSEA_TEST_SIZES"); test_find_glyph ("fallbackdpi", 759); /* find fallback font cmr10@300 */ xputenv ("GFFONTS", "."); test_find_glyph ("cmr10", 300); /* different GFFONTS/TEXFONTS */ return 0; }