]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/open-type-font.cc (attachment_point): new function.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 12 Dec 2004 22:27:35 +0000 (22:27 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 12 Dec 2004 22:27:35 +0000 (22:27 +0000)
(load_table): read LILC table

* buildscripts/gen-bigcheese-scripts.py (Module): new
file. Generate FF scripts.

buildscripts/gen-bigcheese-scripts.py
buildscripts/mf-to-table.py
lily/include/open-type-font.hh
lily/note-head.cc
lily/open-type-font.cc
mf/GNUmakefile
mf/feta-autometric.mf
mf/feta-generic.mf

index 5c20f0209d658dd7a27abe3df13283c5bb25858e..01a1cc5b8e257db09b90920ebad5a02ca0be92f6 100644 (file)
@@ -60,6 +60,7 @@ MergeFonts("feta-alphabet%(design_size)d.pfa");
 MergeKern("feta-alphabet%(design_size)d.tfm");
 
 LoadTableFromFile("LILC", "feta%(design_size)d.otf-table")
+LoadTableFromFile("LILY", "feta%(design_size)d.otf-gtable")
 
 Generate("%(name)s%(design_size)d.otf");
 Generate("%(name)s%(design_size)d.cff");''' % vars()
@@ -71,6 +72,7 @@ Generate("%(name)s%(design_size)d.cff");''' % vars()
 
        deps = r'''%(name)s%(design_size)d.otf: $(outdir)/feta%(design_size)d.pfa \
   $(outdir)/parmesan%(design_size)d.pfa  \
-  $(outdir)/feta-alphabet%(design_size)d.pfa feta%(design_size)d.otf-table
+  $(outdir)/feta-alphabet%(design_size)d.pfa feta%(design_size)d.otf-table \
+  $(outdir)/feta-alphabet%(design_size)d.pfa feta%(design_size)d.otf-gtable
 ''' % vars()
        open (path, 'w').write (deps)
index 63632ff899aee8fca2c5041861ddc59a3303c032..e75b7c2efa1562287f1b1226b75b60c264bfc934 100644 (file)
@@ -118,6 +118,9 @@ def parse_logfile (fn):
                        global_info['Descender'] = '0'
                        global_info['EncodingScheme'] = encoding
 
+               elif tags[0] == 'parameter':
+                       global_info[tags[1]] = tags[2];
+                       
        return (global_info, charmetrics, deps)
 
 
@@ -159,7 +162,7 @@ def write_tex_defs (file, global_info, charmetrics):
        file.write ('\\endinput\n')
 
 
-def write_otf_lisp_table (file, global_info, charmetrics):
+def write_character_lisp_table (file, global_info, charmetrics):
 
        def conv_char_metric (charmetric):
                f = 1.0
@@ -178,6 +181,20 @@ def write_otf_lisp_table (file, global_info, charmetrics):
 
        for c in charmetrics:
                file.write (conv_char_metric (c))
+
+
+def write_global_lisp_table (file, global_info):
+       str = ''
+
+       keys = ['staffsize', 'stafflinethickness', 'staff_space',
+               'linethickness', 'black_notehead_width', 'ledgerlinethickness',
+               'blot_diameter'
+               ]
+       for k in keys:
+               str = str + "(%s . %s)\n" % (k,global_info[k])
+
+       file.write (str)
+
        
 def write_ps_encoding (name, file, global_info, charmetrics):
        encs = ['.notdef'] * 256
@@ -271,10 +288,11 @@ Options:
   getopt.getopt (sys.argv[1:],
                 'a:d:hl:o:p:t:',
                 ['enc=', 'afm=', 'outdir=', 'dep=', 'lisp=',
+                 'global-lisp=',
                  'tex=', 'ly=', 'debug', 'help', 'package='])
 
-
-lisp_nm = ''
+global_lisp_nm = ''
+char_lisp_nm = ''
 enc_nm = ''
 texfile_nm = ''
 depfile_nm = ''
@@ -292,7 +310,9 @@ for opt in options:
        elif o == '--tex' or o == '-t':
                texfile_nm = a
        elif o == '--lisp': 
-               lisp_nm = a
+               char_lisp_nm = a
+       elif o == '--global-lisp': 
+               global_lisp_nm = a
        elif o == '--enc':
                enc_nm = a
        elif o == '--ly' or o == '-l':
@@ -330,7 +350,8 @@ for filenm in files:
                enc_name = 'FetaBraceEncoding'
 
        write_ps_encoding (enc_name, open (enc_nm, 'w'), g, m)
-       write_otf_lisp_table (open (lisp_nm, 'w'), g, m)  
+       write_character_lisp_table (open (char_lisp_nm, 'w'), g, m)  
+       write_global_lisp_table (open (global_lisp_nm, 'w'), g)  
        if depfile_nm:
                write_deps (open (depfile_nm, 'wb'), deps,
                            [base + '.dvi', base + '.pfa', base + '.pfb',
index c6e4e0c740aca92f05e8a38d8273f658bbfbe122..5fe069e1af66d602927a398f948d6d5dc3f5d96d 100644 (file)
 class Open_type_font : public Font_metric
 {
   FT_Face face_; /* handle to face object */
+
   SCM lily_character_table_; 
+  SCM lily_global_table_;
+  
   Open_type_font();
 public:
   static SCM make_otf (String);
index d2bd30b576ffcc6689f1613944cb5372c50722ab..b5781a7a018d5be680bfd7874df1910301bbe391 100644 (file)
@@ -140,7 +140,7 @@ Note_head::stem_attachment_coordinate (Grob *me, Axis a)
       if (k >= 0)
        {
          Box b = fm->get_indexed_char (k);
-         Offset wxwy = fm->get_indexed_wxwy (k);
+         Offset wxwy = fm->attachment_point (key);
          Interval v = b[a];
          if (!v.is_empty ())
            return 2 * (wxwy[a] - v.center ()) / v.length ();
index b72c242824304ed1d2bc7cdc51f276a5feb88a5a..50710eb3afce9e601bfbe10bcd1491c77be0a02a 100644 (file)
@@ -39,6 +39,24 @@ load_table (char const *tag_str, FT_Face face, FT_ULong *length)
   return 0 ;
 }
 
+SCM
+load_scheme_table (char const *tag_str, FT_Face face)
+{
+  FT_ULong length = 0;
+  FT_Byte* buffer =load_table ("LILC", face, &length);
+
+  SCM tab = SCM_EOL;
+  if (buffer)
+    {
+      String contents ((Byte const*)buffer, length);
+      contents = "(quote (" +  contents + "))";
+
+      SCM alist = scm_c_eval_string (contents.to_str0());
+      tab = alist_to_hashq (alist);
+      free (buffer);
+    }
+  return tab;
+}
            
 SCM
 Open_type_font::make_otf (String str)
@@ -57,30 +75,24 @@ Open_type_font::make_otf (String str)
     }
 
 
-  FT_ULong length = 0;
-  FT_Byte* buffer =load_table ("LILC", otf->face_, &length);
-  if (buffer)
-    {
-      String contents ((Byte const*)buffer, length);
-      contents = "(quote (" +  contents + "))";
-
-      SCM alist = scm_c_eval_string (contents.to_str0());
-      otf->lily_character_table_ = alist_to_hashq (alist);
-      free (buffer);
-    }
 
+  otf->lily_character_table_ =  load_scheme_table ("LILC", otf->face_);
+  otf->lily_global_table_ =  load_scheme_table ("LILY", otf->face_);
+  
   return otf->self_scm ();
 }
 
 Open_type_font::Open_type_font()
 {
   lily_character_table_ = SCM_EOL;
+  lily_global_table_ = SCM_EOL;
 }
 
 void
 Open_type_font::derived_mark () const
 {
   scm_gc_mark (lily_character_table_);
+  scm_gc_mark (lily_global_table_);
 }
 
 Offset
index 7cb5f56f1ee7f1314f9fff2c503e406c54699821..49b70b35330f1a137328b7d378b3358f53aeb775 100644 (file)
@@ -162,8 +162,8 @@ get-pfa: get-rpm-pfa
 
 ##
 ## todo: this also depends on .tfm, FIXME.
-$(outdir)/%.lisp $(outdir)/%.afm  $(outdir)/%.enc  $(outdir)/%.tex $(outdir)/%list.ly $(outdir)/%.dep: $(outdir)/%.log $(outdir)/%.tfm
-       $(PYTHON) $(buildscript-dir)/mf-to-table.py --lisp=$(outdir)/$(<F:.log=.lisp) --outdir=$(outdir) --dep $(outdir)/$(<F:.log=.dep)  --afm $(outdir)/$(<F:.log=.afm)  --enc $(outdir)/$(<F:.log=.enc) --tex $(outdir)/$(<F:.log=.tex) --ly $(outdir)/$(<F:.log=list.ly) $<
+$(outdir)/%.lisp $(outdir)/%.otf-gtable $(outdir)/%.afm  $(outdir)/%.enc  $(outdir)/%.tex $(outdir)/%list.ly $(outdir)/%.dep: $(outdir)/%.log $(outdir)/%.tfm
+       $(PYTHON) $(buildscript-dir)/mf-to-table.py --global-lisp=$(outdir)/$(<F:.log=.otf-gtable) --lisp=$(outdir)/$(<F:.log=.lisp) --outdir=$(outdir) --dep $(outdir)/$(<F:.log=.dep)  --afm $(outdir)/$(<F:.log=.afm)  --enc $(outdir)/$(<F:.log=.enc) --tex $(outdir)/$(<F:.log=.tex) --ly $(outdir)/$(<F:.log=list.ly) $<
 
 fontdir: $(addprefix $(outdir)/, lilypond.map lilypond.sfd private-fonts fonts.scale fonts.dir Fontmap.lily)
 
index eaa80fc5aa3b59d0d18bf9bc8d41977f059b5e94..265ce7369de457ef4fcc0c2c91666b31cac772b4 100644 (file)
@@ -42,6 +42,11 @@ def fet_endgroup(expr name) =
        message "";
 enddef;
 
+def autometric_parameter (expr name, value) =
+       message "@{parameter@:"&name&"@:"&decimal value&"@}";
+enddef;
+
+
 def autometric_output_char=
        message "@{char@:"&charnamestr&"@:"&decimal charcode&"@:"&decimal charbp&"@:"&decimal charwd&"@:"&decimal chardp&"@:"&decimal charht&"@:"&decimal charwx&"@:"&decimal charwy&"@:"&idstr&"@:"&texstr&"@}";
 enddef;
index 956cfb8d92012cb9049f6b3fe9682895caec8848..40264ec5cf487f060fe41bd741863f752e75c939 100644 (file)
@@ -23,6 +23,8 @@ input feta-params;
 
 font_x_height  staff_space#;
 
+
+
 fet_beginfont("feta", design_size, "fetaMusic");
 if test = 0: 
        input feta-eindelijk;
@@ -40,5 +42,13 @@ else:
 
 fi
 
+autometric_parameter("staffsize", staffsize#);
+autometric_parameter("stafflinethickness", stafflinethickness#);
+autometric_parameter("staff_space", staff_space#)
+autometric_parameter("linethickness", linethickness#)
+autometric_parameter("black_notehead_width", black_notehead_width#);
+autometric_parameter("ledgerlinethickness", ledgerlinethickness#);
+autometric_parameter("blot_diameter", blot_diameter#);
+
 fet_endfont;