]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/kpath.cc
Add penalty to interface.
[lilypond.git] / lily / kpath.cc
index bc64468e06573421cf21b574be4df2a37e08f738..b108346cfa7907db78c7ed159d1eec1a3fdc6454 100644 (file)
@@ -45,7 +45,7 @@ String
 kpathsea_find_afm (char const * name)
 {
 #if (KPATHSEA && HAVE_KPSE_FIND_FILE)
-  char * name_ptr =  kpse_find_file (name, kpse_afm_format, true);
+  char * name_ptr =  kpse_find_file (name, kpse_afm_format, false);
 
   if (!name_ptr)
     {
@@ -63,22 +63,29 @@ kpathsea_find_afm (char const * name)
 }
 
 String
-kpathsea_find_tfm (char const * name)
+kpathsea_find_tfm (char const *name)
 {
-  String p = global_path.find (String (name) + ".tfm");
-
-  if (p.length ())
-    return p;
-  
+  String filename = global_path.find (String (name) + ".tfm");
 #if (KPATHSEA && HAVE_KPSE_FIND_FILE)
-  char * name_ptr =  kpse_find_file (name, kpse_tfm_format, true);
-  if (!name_ptr)
-    warning (_f ("kpathsea can not find TFM file: `%s'", name));
-  else
-    return name_ptr;
+  if (filename.is_empty ())
+    {
+      /* If invoked for a TeX font, we could do TRUE (must exist).
+        We could also do:
+          p = kpse_find_file (name, kpse_mf_format, false);
+          if (p)
+            p = kpse_find_file (name, kpse_mf_format, true);
+
+            but we assume that if there is a .PFA, there is also a .TFM,
+        and it's no use generating TFMs on the fly, because PFAs cannot
+        be generated on the fly. */
+      char *p = kpse_find_file (name, kpse_tfm_format, false);
+      if (!p)
+       warning (_f ("kpathsea can not find TFM file: `%s'", name));
+      else
+       filename = p;
+    }
 #endif
-
-  return "";
+  return filename;
 }
 
 #if KPATHSEA
@@ -145,7 +152,7 @@ LY_DEFINE (ly_kpathsea_gulp_file, "ly:kpathsea-gulp-file",
           "Read the file @var{name}, and return its contents in a string.  "
           "The file is looked up using the search path and kpathsea.")
 {
-  SCM_ASSERT_TYPE (ly_string_p (name), name, SCM_ARG1, __FUNCTION__, "string");
+  SCM_ASSERT_TYPE (is_string (name), name, SCM_ARG1, __FUNCTION__, "string");
   return scm_makfrom0str
     (kpathsea_gulp_file_to_string (ly_scm2string (name)).to_str0 ());
 }