]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/all-font-metrics.cc
patch::: 1.5.43.jcn2
[lilypond.git] / lily / all-font-metrics.cc
index ce1c5edb3aef2889017a376de08ce0b5c406dd07..91fcbcf3de130fe09375761552de306215ad0fb9 100644 (file)
@@ -3,7 +3,7 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1999--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1999--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
 
@@ -30,8 +30,8 @@ All_font_metrics::All_font_metrics (String path)
 
 All_font_metrics::~All_font_metrics ()
 {
-  scm_unprotect_object (afm_p_dict_->self_scm ());
-  scm_unprotect_object (tfm_p_dict_->self_scm ());
+  scm_gc_unprotect_object (afm_p_dict_->self_scm ());
+  scm_gc_unprotect_object (tfm_p_dict_->self_scm ());
 }
 
 Adobe_font_metric *
@@ -52,8 +52,8 @@ All_font_metrics::find_afm (String name)
 
       if (path.empty_b ())
        {
-         char  * p = ly_find_afm (name.ch_C ());
-         if (p)
+         String p = ly_find_afm (name.ch_C ());
+         if (p.length_i ())
            path = p;
        }
 
@@ -72,14 +72,19 @@ All_font_metrics::find_afm (String name)
 
       afm_p_dict_->set (sname,val);
 
-      scm_unprotect_object (val);
+      scm_gc_unprotect_object (val);
 
 
       Adobe_font_metric *afm
        = dynamic_cast<Adobe_font_metric*> (unsmob_metrics (val));
 
-      if (output_format_global == "tex")
+      /*
+       only check checksums if there is one.  We take the risk that
+       some file has valid checksum 0
+      */
+      if (afm->checksum_)
        {
+         
          Tex_font_metric * tfm = find_tfm (name);
          
          /* FIXME: better warning message
@@ -118,8 +123,8 @@ All_font_metrics::find_tfm (String name)
       
       if (path.empty_b ())
        {
-         char * p = ly_find_tfm (name.ch_C ());
-         if (p)
+         String p = ly_find_tfm (name.ch_C ());
+         if (p.length_i ())
            path = p;
        }
 
@@ -140,7 +145,7 @@ All_font_metrics::find_tfm (String name)
       unsmob_metrics (val)->description_ = gh_cons (name_str, gh_double2scm (1.0));
       tfm_p_dict_->set (sname, val);
 
-      scm_unprotect_object (val);
+      scm_gc_unprotect_object (val);
     }
 
   return