]> git.donarmstrong.com Git - lilypond.git/blob - lily/kpath.cc
release: 1.3.136
[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
10 #include <stdio.h>
11
12 #include "config.h"
13 #include "string.hh"
14
15 #define popen REALLYUGLYKLUDGE
16 #define pclose ANOTHERREALLYUGLYKLUDGE
17
18 #if HAVE_KPATHSEA_KPATHSEA_H
19 extern "C" {
20 #include <kpathsea/kpathsea.h>
21 #include <kpathsea/tex-file.h>
22 }
23 #endif
24
25 #include "kpath.hh"
26 #include "version.hh"
27
28
29 char * 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 * ly_find_tfm (char const * name)
38 {
39 #if (KPATHSEA && HAVE_KPSE_FIND_FILE)
40   return kpse_find_file (name, kpse_tfm_format, true);
41 #endif
42   return 0;
43 }
44
45
46 void
47 ly_init_kpath (char *av0)
48 {
49 #if KPATHSEA && HAVE_KPATHSEA_KPATHSEA_H
50   /*
51    initialize kpathsea
52    */
53   kpse_set_program_name(av0, NULL);
54   kpse_maketex_option("tfm", TRUE);
55
56   /*
57     ugh: apparently the program_args is non-functional.
58    */
59 #define VERSION MAJOR_VERSION "." MINOR_VERSION "."  PATCH_LEVEL
60   
61 #define MY_TFMPATH "$VARTEXFONTS/tfm/lilypond/" VERSION "/"
62
63   char * mypath = kpse_expand (MY_TFMPATH);
64   String prog = "mktextfm --destdir ";
65   prog += mypath;
66   
67   kpse_format_info[kpse_tfm_format].program = strdup (prog.ch_C());
68   kpse_format_info[kpse_tfm_format].client_path = mypath;
69 #endif
70 }
71
72