#include "tfm.hh"
#include "lily-guile.hh"
#include "scm-hash.hh"
+#include "kpath.hh"
+
+
-#if HAVE_KPATHSEA_KPATHSEA_H
-extern "C" {
-#include <kpathsea/kpathsea.h>
-}
-#endif
const char * default_font_sz_ = "cmr10";
if (path.empty_b())
path = search_path_.find (name + ".afm");
-#if (KPATHSEA && HAVE_KPSE_FIND_FILE)
if (path.empty_b ())
{
- char * p = kpse_find_file (name.ch_C(), kpse_afm_format, true);
+ char * p = ly_find_afm (name.ch_C());
if (p)
path = p;
}
-#endif
-
+
if (path.empty_b())
return 0;
{
String path;
-//#if KPATHSEA && HAVE_KPSE_FIND_TFM -- urg: a macro
-#if KPATHSEA && HAVE_KPSE_FIND_FILE
if (path.empty_b())
{
- char * p = kpse_find_tfm (name.ch_C());
+ char * p = ly_find_tfm (name.ch_C());
if (p)
path = p;
}
-#endif
+
if (path.empty_b())
path = search_path_.find (name + ".tfm");
if (path.empty_b())
--- /dev/null
+/*
+kpath.hh -- declare kpath funcs.
+
+source file of the GNU LilyPond music typesetter
+
+(c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#ifndef KPATH_HH
+#define KPATH_HH
+
+
+
+char * ly_find_afm (char const * name);
+char * ly_find_tfm (char const * name);
+void ly_init_kpath (char *av0);
+
+
+
+#endif /* KPATH_HH */
+
TYPE ## _ ## FUNC ## _init_functions () \
{ \
TYPE ## _ ## FUNC ## _proc = gh_new_procedure1_0 (#TYPE "::" #FUNC, \
- (SCM(*)(...))TYPE :: FUNC); \
+ (SCM(*)(SCM))TYPE :: FUNC); \
} \
\
ADD_SCM_INIT_FUNC(TYPE ## _ ## FUNC ## _callback, TYPE ## _ ## FUNC ## _init_functions); \
--- /dev/null
+/*
+kpath.cc -- glue kpathsea to lily. Need some ugly kludges for gcc 2.96
+
+source file of the GNU LilyPond music typesetter
+
+(c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include <stdio.h>
+#include "config.h"
+
+#define popen REALLYUGLYKLUDGE
+#define pclose ANOTHERREALLYUGLYKLUDGE
+
+#if HAVE_KPATHSEA_KPATHSEA_H
+extern "C" {
+#include <kpathsea/kpathsea.h>
+#include <kpathsea/tex-file.h>
+}
+#endif
+
+#include "kpath.hh"
+
+
+
+char * ly_find_afm (char const * name)
+{
+#if (KPATHSEA && HAVE_KPSE_FIND_FILE)
+ return kpse_find_file (name, kpse_afm_format, true);
+#endif
+ return 0;
+}
+
+char * ly_find_tfm (char const * name)
+{
+#if (KPATHSEA && HAVE_KPSE_FIND_FILE)
+ return kpse_find_file (name, kpse_tfm_format, true);
+#endif
+ return 0;
+}
+
+
+void
+ly_init_kpath (char *av0)
+{
+#if KPATHSEA && HAVE_KPATHSEA_KPATHSEA_H
+ /*
+ initialize kpathsea
+ */
+ kpse_set_program_name(av0, NULL);
+ kpse_maketex_option("tfm", TRUE);
+#endif
+}