]> git.donarmstrong.com Git - lilypond.git/blob - lily/kpath.cc
0e39e0c1ff8c60227c9c22cb9cb55db8f711a808
[lilypond.git] / lily / kpath.cc
1 /*   
2   kpath.cc -- glue kpathsea to lily. Need some ugly kludges for gcc 2.96
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2000--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include <stdio.h>
10 #include <string.h>
11
12 #include "config.h"
13
14 #define popen REALLYUGLYKLUDGE
15 #define pclose ANOTHERREALLYUGLYKLUDGE
16
17 #if HAVE_KPATHSEA_KPATHSEA_H
18 extern "C" {
19 #include <kpathsea/kpathsea.h>
20 #include <kpathsea/tex-file.h>
21 }
22 #endif
23
24 #include "file-path.hh"
25 #include "string.hh"
26 #include "main.hh"
27 #include "kpath.hh"
28 #include "lily-version.hh"
29
30
31 char *
32 ly_find_afm (char const * name)
33 {
34 #if (KPATHSEA && HAVE_KPSE_FIND_FILE)
35   return kpse_find_file (name, kpse_afm_format, true);
36 #endif
37   return 0;
38 }
39
40 String
41 ly_find_tfm (char const * name)
42 {
43   String p = global_path.find (String (name) + ".tfm");
44
45   if (p.length_i ())
46     return p;
47   
48 #if (KPATHSEA && HAVE_KPSE_FIND_FILE)
49   return kpse_find_file (name, kpse_tfm_format, true);
50 #endif
51   return "";
52 }
53
54
55 void
56 ly_init_kpath (char *av0)
57 {
58 #if KPATHSEA && HAVE_KPATHSEA_KPATHSEA_H
59   /*
60     We take two pronged approach to tfms:
61
62     * the lilypond tfms (feta*.tfm) are found through our own routines.
63
64     * the TeX tfms are found through vanilla kpathsea.
65
66     (* other TFMs are not found, i.e. don't use them. )
67
68     PRO:
69  
70     - TFM and AFM checksums always match in Lily.
71
72     - less hassle, no kpathsea spaghetti
73
74     CON:
75
76     - feta PK files are often recreated, locally
77     Solution: cache PK files locally?
78
79     - need env. vars to make sure that TeX finds the TFMs
80
81     - Outdated PK (TFM?) font files are not automatically removed,
82     since VERSION is not part of the standard location.
83
84
85     ALTERNATIVE
86
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.
91     
92   */
93
94   /*
95    initialize kpathsea
96    */
97   kpse_set_program_name (av0, NULL);
98   kpse_maketex_option ("tfm", TRUE);
99 #endif
100 }
101
102