]> git.donarmstrong.com Git - lilypond.git/blob - lily/kpath.cc
e061214ef156aebaed35110489020d0b38ac14bb
[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
11 #include "config.h"
12 #include "string.hh"
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 "kpath.hh"
25 #include "lily-version.hh"
26
27
28 char *
29 ly_find_afm (char const * name)
30 {
31 #if (KPATHSEA && HAVE_KPSE_FIND_FILE)
32   return kpse_find_file (name, kpse_afm_format, true);
33 #endif
34   return 0;
35 }
36
37 char *
38 ly_find_tfm (char const * name)
39 {
40 #if (KPATHSEA && HAVE_KPSE_FIND_FILE)
41   return kpse_find_file (name, kpse_tfm_format, true);
42 #endif
43   return 0;
44 }
45
46
47 void
48 ly_init_kpath (char *av0)
49 {
50 #if KPATHSEA && HAVE_KPATHSEA_KPATHSEA_H
51   /*
52    initialize kpathsea
53    */
54   kpse_set_program_name (av0, NULL);
55   kpse_maketex_option ("tfm", TRUE);
56
57   String my_tfm = "$VARTEXFONTS/tfm/lilypond/";
58   my_tfm += version_str () + "/";
59
60   char * mypath = kpse_expand (my_tfm.ch_C ());
61   String prog = "mktextfm --destdir ";
62   prog += mypath;
63   
64   kpse_format_info[kpse_tfm_format].program = strdup (prog.ch_C ());
65   kpse_format_info[kpse_tfm_format].client_path = mypath;
66 #endif
67 }
68
69