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.
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],
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)
checksum_ = 0;
font_inf_ = fi;
+ design_size_ = 1.0;
+
for (int i= 256 >? fi->numOfChars; i--;)
ascii_to_metric_idx_.push (-1);
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 ();
}
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++)
{
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);
}
}
}
fclose (f);
- return Adobe_font_metric::make_afm (fi, cs);
+ return Adobe_font_metric::make_afm (fi, cs, ds);
}
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_;