]> git.donarmstrong.com Git - lilypond.git/commitdiff
* buildscripts/mf-to-table.py (base): add DesignSize comment.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 2 Apr 2004 22:49:31 +0000 (22:49 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 2 Apr 2004 22:49:31 +0000 (22:49 +0000)
* lily/afm.cc (read_afm_file): read design size.

ChangeLog
buildscripts/mf-to-table.py
lily/afm.cc
lily/include/afm.hh

index a35b4c8016a75f953f754120c5b5594c40a596dd..a8482d819acde8998fcf81a359b6ec0359c53eb4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2004-04-03  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
+       * buildscripts/mf-to-table.py (base): add DesignSize comment.
+
+       * lily/afm.cc (read_afm_file): read design size.
+
        * input/regression/repeat-unfold-tremolo.ly: add dotted case.
 
        * scm/music-functions.scm (unfold-repeats): handle dots too.
index b78ed88b6b5da617f08d18b5ccfb7b278f066326..a28c745ae14fe5f601f1eee88073248f37703119 100644 (file)
@@ -92,6 +92,8 @@ def parse_logfile (fn):
                        if 0: #testing
                                tags.append ('Regular')
                        name = tags[1:]
+                       global_info['DesignSize'] = string.atof (tags[4])
+                       
                        global_info['FontName'] = string.join (name,'-')
                        global_info['FullName'] = string.join (name,' ')
                        global_info['FamilyName'] = string.join (name[1:-1],
@@ -275,6 +277,10 @@ for filenm in files:
 
        write_afm_header (afm)
        afm.write ("Comment TfmCheckSum %d\n" % cs)
+       afm.write ("Comment DesignSize %.2f\n" % g['DesignSize'])
+
+       del g['DesignSize']
+       
        write_afm_metric (afm, g, m)
        
        write_tex_defs (open (texfile_nm, 'w'), g, m)
index f79ba628bb3dc93de687d6ca770c723e3426b16c..b0787ac362374440f98887a517a87c5327a69482 100644 (file)
@@ -20,6 +20,8 @@ Adobe_font_metric::Adobe_font_metric (AFM_Font_info * fi)
   checksum_ = 0;
   font_inf_ = fi;
 
+  design_size_ = 1.0;
+  
   for (int i= 256  >? fi->numOfChars; i--;)
     ascii_to_metric_idx_.push (-1);
   
@@ -40,10 +42,13 @@ Adobe_font_metric::Adobe_font_metric (AFM_Font_info * fi)
 
 
 SCM
-Adobe_font_metric::make_afm (AFM_Font_info *fi, unsigned int checksum)
+Adobe_font_metric::make_afm (AFM_Font_info *fi,
+                            unsigned int checksum,
+                            Real design_size)
 {
   Adobe_font_metric * fm = new Adobe_font_metric (fi);
   fm->checksum_ = checksum;
+  fm->design_size_ = design_size;
   return fm->self_scm ();    
 }
 
@@ -118,12 +123,13 @@ SCM
 read_afm_file (String nm)
 {
   FILE *f = fopen (nm.to_str0 () , "r");
-  char s[2048];
+  char s[2048] = "";
   char *check_key = "Comment TfmCheckSum";
+  char *size_key = "Comment DesignSize";
 
   unsigned int cs = 0;
-
-  s[0] = 0;
+  Real ds = 1.0;
+  
   /* Assume check_key in first 10 lines */
   for (int i = 0; i < 10; i++)
     {
@@ -131,7 +137,10 @@ read_afm_file (String nm)
       if (strncmp (s, check_key, strlen (check_key)) == 0)
        {
          sscanf (s + strlen (check_key), "%ud", &cs);
-         break;
+       }
+      else if (strncmp (s, size_key, strlen (size_key)) == 0)
+       {
+         sscanf (s + strlen (size_key), "%lf", &ds);
        }
     }
   
@@ -147,7 +156,7 @@ read_afm_file (String nm)
     }
   fclose (f);
 
-  return Adobe_font_metric::make_afm (fi, cs);
+  return Adobe_font_metric::make_afm (fi, cs, ds);
 }
 
 
index 14ab748e93d9c6ab03b1e54df26ff4ff5a639a7a..ce374f03f5178f90b651315ad4d75be18cfb160c 100644 (file)
@@ -34,9 +34,10 @@ struct Adobe_font_metric : Font_metric
 
   String to_string () const;
   ~Adobe_font_metric ();
-  static SCM make_afm (AFM_Font_info*, unsigned);
+  static SCM make_afm (AFM_Font_info*, unsigned, Real);
 
   unsigned int checksum_;
+  Real design_size_;
 protected:
   Array<int> ascii_to_metric_idx_;
   std::map<String,int> name_to_metric_dict_;