2 kpath.cc -- glue kpathsea to lily. Need some ugly kludges for gcc 2.96
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
14 #define popen REALLYUGLYKLUDGE
15 #define pclose ANOTHERREALLYUGLYKLUDGE
17 #if HAVE_KPATHSEA_KPATHSEA_H
19 #include <kpathsea/kpathsea.h>
20 #include <kpathsea/tex-file.h>
24 #include "file-path.hh"
28 #include "lily-version.hh"
32 ly_find_afm (char const * name
)
34 #if (KPATHSEA && HAVE_KPSE_FIND_FILE)
35 return kpse_find_file (name
, kpse_afm_format
, true);
41 ly_find_tfm (char const * name
)
43 String p
= global_path
.find (String (name
) + ".tfm");
48 #if (KPATHSEA && HAVE_KPSE_FIND_FILE)
49 return kpse_find_file (name
, kpse_tfm_format
, true);
56 ly_init_kpath (char *av0
)
58 #if KPATHSEA && HAVE_KPATHSEA_KPATHSEA_H
60 We take two pronged approach to tfms:
62 * the lilypond tfms (feta*.tfm) are found through our own routines.
64 * the TeX tfms are found through vanilla kpathsea.
66 (* other TFMs are not found, i.e. don't use them. )
70 - TFM and AFM checksums always match in Lily.
72 - less hassle, no kpathsea spaghetti
76 - feta PK files are often recreated, locally
77 Solution: cache PK files locally?
79 - need env. vars to make sure that TeX finds the TFMs
81 - Outdated PK (TFM?) font files are not automatically removed,
82 since VERSION is not part of the standard location.
87 we have tried to come up with schemes that leave this kind of work
88 to kpathsea with objective of fixing the CONs, but miserably
89 failed. TeX installations and kpathsea itself form a buggy,
90 inconsistent, and unorderly mess.
97 kpse_set_program_name (av0
, NULL
);
98 kpse_maketex_option ("tfm", TRUE
);
105 Remove the setting for TFMFONTS if we have kpathsea, because
106 kpathsea can find TFM fonts anyway.
108 If we don't lily will want to make tfms for cmr fonts, even if
109 there is a :: entry in the TFMFONTS path.
111 This will fail if a user has special fonts (outside of feta) that
112 can not be found by kpath.
114 If TFMFONTS is unset, TFMs of feta will be generated on the
115 fly. The risk is that this will cause checksum mismatch errors,
116 but MF is reasonably deterministic (so we hope not).
118 The advantage is that the PK font will also be generated under
119 /var/texmf/fonts, reducing clutter and compilation time.
123 #ifndef __CYGWIN__ /* mktextfm/mktexpk does not work on windows */
124 unsetenv ("TFMFONTS");
128 String my_tfm
= "$VARTEXFONTS/tfm/public/lilypond";
130 String my_tfm
= "$VARTEXFONTS/tfm/lilypond/";
131 my_tfm
+= version_str () + "/";
135 char * mypath
= strdup ((my_tfm
+ ":").ch_C());
136 kpse_format_info
[kpse_tfm_format
].client_path
= mypath
;
138 char * mypath
= kpse_expand (my_tfm
.ch_C ());
140 String prog
= "mktextfm --destdir ";
143 kpse_format_info
[kpse_tfm_format
].program
= strdup (prog
.ch_C ());