]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/output-tex.scm (named-glyph): new function. This fixes TeX output.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 16 Dec 2004 23:57:31 +0000 (23:57 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 16 Dec 2004 23:57:31 +0000 (23:57 +0000)
* scm/framework-tex.scm (otf-font-load-command): load subfonts.
(tex-font-command-raw): new function.

* lily/include/virtual-font-metric.hh (Module): remove file

* lily/virtual-font-metric.cc (Module): remove file.

* lily/open-type-font.cc (LY_DEFINE): ly:otf-font-glyph-info
(get_indexed_char): read bbox from lily table if present.

20 files changed:
ChangeLog
buildscripts/mf-to-table.py
lily/include/open-type-font.hh
lily/include/stem.hh
lily/include/tuplet-bracket.hh
lily/include/virtual-font-metric.hh [deleted file]
lily/open-type-font.cc
lily/paper-def.cc
lily/score-engraver.cc
lily/stem.cc
lily/sustain-pedal.cc
lily/text-item.cc
lily/tuplet-bracket.cc
lily/virtual-font-metric.cc [deleted file]
mf/GNUmakefile
mf/feta-beugel.mf
scm/define-grobs.scm
scm/framework-tex.scm
scm/output-tex.scm
scm/safe-lily.scm

index e6e82d4a316a5fb93b9931316975eb7558b8adda..22db230b1429bd9cb88711b0689bc0c22f469767 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2004-12-17  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * scm/output-tex.scm (named-glyph): new function. This fixes TeX output.
+
+       * scm/framework-tex.scm (otf-font-load-command): load subfonts.
+       (tex-font-command-raw): new function.
+
+       * lily/include/virtual-font-metric.hh (Module): remove file
+
+       * lily/virtual-font-metric.cc (Module): remove file.
+       
+
+       * lily/open-type-font.cc (LY_DEFINE): ly:otf-font-glyph-info
+       (get_indexed_char): read bbox from lily table if present.
+
+2004-12-16  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * mf/GNUmakefile ($(outdir)/aybabtu.subfonts): rule for
+       aybabtu.subfonts
+
+       * mf/feta-beugel.mf (y): don't number consecutively, instead, use
+       global glyphname. Enables more than 64 glyphs in the OTF.
+
 2004-12-16  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * scm/font.scm (add-music-fonts): Load aybabtu iso all separate
index e19a96b0efbc69db76e8356aa5a5cf1d5df3ebe6..97effe82ce7e3b60c9da31eff3501e3a7a14335a 100644 (file)
@@ -63,7 +63,10 @@ font_family = 'feta'
 def parse_logfile (fn):
        (autolines, deps) = read_log_file (fn)
        charmetrics = []
-       global_info = {}
+       
+       global_info = {
+               'filename' : os.path.splitext (os.path.basename (fn))[0]
+               }
        group = ''
 
        for l in autolines:
@@ -171,14 +174,18 @@ def write_character_lisp_table (file, global_info, charmetrics):
                f = 1.0
                s = """(%s .
 ((bbox . (%f %f %f %f))
+ (subfont . "%s")
+ (subfont-index . %d)
  (attachment . (%f . %f))))
 """ %(charmetric['name'],
-                -charmetric['breapth'] * f,
-                -charmetric['depth'] * f,
-                charmetric['width'] * f,
-                charmetric['height'] * f,
-                charmetric['wx'],
-                charmetric['wy'])
+      -charmetric['breapth'] * f,
+      -charmetric['depth'] * f,
+      charmetric['width'] * f,
+      charmetric['height'] * f,
+      global_info['filename'],
+      charmetric['code'],
+      charmetric['wx'],
+      charmetric['wy'])
 
                return s
 
index a369d4849428e0bab2d983b6f98c895730bb54ad..1f9890e3429623573183d079f3eebc16df66053f 100644 (file)
@@ -15,7 +15,7 @@
 #include "font-metric.hh"
 
 typedef std::map<FT_UInt, FT_ULong> Index_to_charcode_map;
-//typedef std::map<String, FT_ULong> Glyph_name_to_charcode_map;
+typedef std::map<String, FT_ULong> Glyph_name_to_index_map;
 
 class Open_type_font : public Font_metric
 {
@@ -25,10 +25,14 @@ class Open_type_font : public Font_metric
   SCM lily_character_table_; 
   SCM lily_global_table_;
   Index_to_charcode_map index_to_charcode_map_;
-  //Glyph_name_to_charcode_map glyph_name_to_charcode_map_;
+  Glyph_name_to_index_map glyph_name_to_index_map_;
   Open_type_font (FT_Face);
 
 public:
+  SCM get_subfonts () const;
+  SCM get_global_table () const;
+  SCM get_char_table () const;
+  
   static SCM make_otf (String);
   virtual ~Open_type_font();
   virtual Offset attachment_point (String) const;
index b9134d120f043e082e642fe628cd3744a43325e9..fb5acd4374d47071a9ff9a3ede9a3be8c75cd604 100644 (file)
@@ -42,9 +42,9 @@ public:
   static void set_spacing_hints (Grob *);
   
   DECLARE_SCHEME_CALLBACK (print, (SCM));
-  DECLARE_SCHEME_CALLBACK (off_callback, (SCM element, SCM axis));
+  DECLARE_SCHEME_CALLBACK (offset_callback, (SCM element, SCM axis));
   DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM));
-  DECLARE_SCHEME_CALLBACK (dim_callback, (SCM smob, SCM axis));
+  DECLARE_SCHEME_CALLBACK (width_callback, (SCM smob, SCM axis));
   DECLARE_SCHEME_CALLBACK (height, (SCM, SCM));
 
 private:
index 620f6b28cc4b33d6fa91e8704592a6db87ff4430..e3f460dbb87ed698f4faf83c71e202e9ca2097b7 100644 (file)
 #include "lily-guile.hh"
 #include "lily-proto.hh"
 
-/*
-
-    TODO: quantise, we don't want to collide with staff lines.
- (or should we be above staff?)
-
-  todo: handle breaking elegantly.
-*/
 class Tuplet_bracket
 {
 public:
+  DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM ));
+  DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM ));
   DECLARE_SCHEME_CALLBACK (print, (SCM ));
+  
   static bool has_interface (Grob*);
-
   static void add_column (Grob*me,Item*);
   static void add_beam (Grob*me,Grob*);
   static Grob *parallel_beam (Grob *me, Link_array<Grob> const&cols, bool *equally_long);
   static void calc_position_and_height (Grob*,Real*,Real *dy);
-  
-  DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM ));
-
-  DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM ));
   static Stencil make_bracket (Grob *me,  Axis protusion_axis,
                                Offset dz,  Drul_array<Real> height,
                                Interval gap, Drul_array<Real> widen,
diff --git a/lily/include/virtual-font-metric.hh b/lily/include/virtual-font-metric.hh
deleted file mode 100644 (file)
index 200c1ff..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-
-/*   
-virtual-font-metric.hh -- declare Virtual_font_metric
-
-source file of the GNU LilyPond music typesetter
-
-(c) 2002--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
- */
-
-#ifndef VIRTUAL_FONT_METRIC_HH
-#define VIRTUAL_FONT_METRIC_HH
-
-#include "font-metric.hh"
-
-class Virtual_font_metric : public Font_metric
-{
-  SCM font_list_;
-
-public:
-  SCM get_font_list () const;
-  Virtual_font_metric (SCM namelist);
-  virtual Real design_size () const;
-  virtual int count () const;
-  virtual Box get_indexed_char (int ascii) const;
-  virtual Box get_ascii_char (int ascii) const;
-  virtual Stencil get_indexed_char_stencil (int ascii) const;
-  virtual Stencil get_ascii_char_stencil (int ascii) const;
-  virtual Offset get_indexed_wxwy (int) const;
-  virtual int name_to_index (String)const;
-  virtual Stencil find_by_name (String) const;
-  virtual String coding_scheme () const;
-
-protected:
-  virtual void derived_mark () const;
-};
-
-
-#endif /* VIRTUAL_FONT_METRIC_HH */
-
index 741db31b4357e59090d3fa20c9788ad9f8102d21..9d0154a771fedaf681d8a637fbbc24e3e330ca7e 100644 (file)
@@ -15,7 +15,7 @@
 #include "warn.hh"
 #include "open-type-font.hh"
 #include "dimensions.hh"
-
+#include "modified-font-metric.hh"
 
 const Real point_constant = 1 PT;
 
@@ -62,7 +62,7 @@ load_scheme_table (char const *tag_str, FT_Face face)
 }
 
 
-Index_to_charcode_map
+Index_to_charcode_map 
 make_index_to_charcode_map (FT_Face face)
 {
   Index_to_charcode_map m;
@@ -75,29 +75,6 @@ make_index_to_charcode_map (FT_Face face)
   return m;
 }
 
-#if 0
-Glyph_name_to_charcode_map
-make_glyph_name_to_charcode_map (FT_Face face)
-{
-  Glyph_name_to_charcode_map m;
-  FT_ULong charcode;
-  FT_UInt gindex;
-  char buffer[1024];
-
-  for (charcode = FT_Get_First_Char (face, &gindex); gindex != 0;
-       charcode = FT_Get_Next_Char (face, charcode, &gindex))
-    {
-      if (FT_Get_Glyph_Name (face, gindex, buffer, sizeof (buffer) - 1))
-       {
-         programming_error ("no glyph name");
-         continue;
-       }
-      m[String (buffer)] = charcode;
-    }
-  return m;
-}
-#endif
-
 Open_type_font::~Open_type_font()
 {
   FT_Done_Face (face_);
@@ -124,7 +101,6 @@ Open_type_font::make_otf (String str)
   return otf->self_scm ();
 }
 
-
 Open_type_font::Open_type_font (FT_Face face)
 {
   face_ = face;
@@ -136,8 +112,6 @@ Open_type_font::Open_type_font (FT_Face face)
   lily_global_table_ = alist_to_hashq (load_scheme_table ("LILY", face_));
   lily_subfonts_ = load_scheme_table ("LILF", face_);
   index_to_charcode_map_ = make_index_to_charcode_map (face_);
-  
-  //glyph_name_to_charcode_map_ = make_glyph_name_to_charcode_map (face_);
 }
 
 void
@@ -159,16 +133,47 @@ Open_type_font::attachment_point (String glyph_name) const
     return o;
 
   SCM char_alist = entry;
-
-  
   SCM att_scm = scm_cdr (scm_assq (ly_symbol2scm ("attachment"), char_alist));
   
   return point_constant * ly_scm2offset (att_scm);
 }
 
+
 Box
 Open_type_font::get_indexed_char (int signed_idx) const
 {
+  if (SCM_HASHTABLE_P (lily_character_table_))
+    {
+      const int len =256;
+      char name[len];
+      int code = FT_Get_Glyph_Name (face_, signed_idx, name, len);
+      if (code)
+       {
+         warning ("FT_Get_Glyph_Name() returned error");
+       }
+       
+      SCM sym = ly_symbol2scm (name);
+      SCM alist = scm_hashq_ref (lily_character_table_, sym, SCM_BOOL_F);
+      
+      if (alist != SCM_BOOL_F)
+       {
+         SCM bbox = scm_cdr (scm_assq (ly_symbol2scm ("bbox"), alist));
+      
+         Box b;
+         b[X_AXIS][LEFT] = scm_to_double (scm_car (bbox));
+         bbox = scm_cdr (bbox);
+         b[Y_AXIS][LEFT] = scm_to_double (scm_car (bbox));
+         bbox = scm_cdr (bbox);
+         b[X_AXIS][RIGHT] = scm_to_double (scm_car (bbox));
+         bbox = scm_cdr (bbox);
+         b[Y_AXIS][RIGHT] = scm_to_double (scm_car (bbox));
+         bbox = scm_cdr (bbox);
+
+         b.scale (point_constant);
+         return b;
+       }
+    }
+  
   FT_UInt idx = signed_idx;
   FT_Load_Glyph (face_,
                 idx,
@@ -201,7 +206,7 @@ Open_type_font::index_to_charcode (int i) const
 
 #if 0
 unsigned
-Open_type_font::glyph_name_to_charcode (String glyph_name) const
+Open_type_font::glyph_name_to_index (String glyph_name) const
 {
   return ((Open_type_font*) this)->glyph_name_to_charcode_map_[glyph_name];
 }
@@ -233,3 +238,36 @@ LY_DEFINE (ly_font_sub_fonts, "ly:font-sub-fonts", 1, 0, 0,
   return fm->sub_fonts ();
 }
 
+LY_DEFINE (ly_otf_font_glyph_info, "ly:otf-font-glyph-info", 2, 0, 0,
+         (SCM font, SCM glyph),
+          "Given the font metric @var{font} of an OpenType font, return the "
+          "information about named glyph @var{glyph} (a string)")
+{
+  Modified_font_metric * fm
+    = dynamic_cast<Modified_font_metric*> (unsmob_metrics (font));
+  Open_type_font * otf = dynamic_cast<Open_type_font*> (fm->original_font ());
+  SCM_ASSERT_TYPE (otf, font, SCM_ARG1, __FUNCTION__, "OTF font-metric");
+  SCM_ASSERT_TYPE (scm_is_string (glyph), glyph, SCM_ARG1,
+                  __FUNCTION__, "string");
+
+  SCM sym = scm_string_to_symbol (glyph);
+  return scm_hashq_ref (otf->get_char_table (), sym, SCM_EOL);
+}
+
+SCM
+Open_type_font::get_char_table () const
+{
+  return lily_character_table_;
+}
+
+SCM
+Open_type_font::get_subfonts () const
+{
+  return lily_subfonts_;
+}
+
+SCM
+Open_type_font::get_global_table () const
+{
+  return lily_global_table_;
+}
index 401b824f285efa9b3ca32a15fcda36e13ea59e04..6b89f107cbfa760effb2907bdf6ef8cd101e9816 100644 (file)
@@ -10,7 +10,6 @@
 #include "ly-module.hh"
 #include "output-def.hh"
 #include "modified-font-metric.hh"
-#include "virtual-font-metric.hh"
 
 Real
 output_scale (Output_def *od)
@@ -27,8 +26,6 @@ find_scaled_font (Output_def *mod, Font_metric *f, Real m,
     return find_scaled_font (mod->parent_, f, m, font_encoding, input_encoding);
   
   Real lookup_mag = m;
-  if (!dynamic_cast<Virtual_font_metric*> (f))
-    lookup_mag /= output_scale (mod);
 
   SCM font_table = mod->lookup_variable (ly_symbol2scm ("scaled-fonts"));
   if (scm_hash_table_p (font_table) != SCM_BOOL_T)
@@ -47,35 +44,7 @@ find_scaled_font (Output_def *mod, Font_metric *f, Real m,
   else
     sizes = SCM_EOL;
   
-  /* Hmm. We're chaining font - metrics.  Should consider whether to
-     merge virtual-font and scaled_font.  */
-  SCM val = SCM_EOL;
-  if (Virtual_font_metric * vf = dynamic_cast<Virtual_font_metric*> (f))
-    {
-      /* For fontify_atom (), the magnification and name must be known
-        at the same time. That's impossible for
-        
-        Scaled (Virtual_font (Font1,Font2))
-        
-        so we replace by
-        
-        Virtual_font (Scaled (Font1), Scaled (Font2))  */
-      SCM lst = SCM_EOL;
-      SCM *t = &lst;
-      for (SCM s = vf->get_font_list (); scm_is_pair (s); s = scm_cdr (s))
-       {
-         Font_metric *scaled
-           = find_scaled_font (mod, unsmob_metrics (scm_car (s)), m,
-                               font_encoding, input_encoding);
-         *t = scm_cons (scaled->self_scm (), SCM_EOL);
-         t = SCM_CDRLOC (*t);
-       }
-
-      vf = new Virtual_font_metric (lst);
-      val = vf->self_scm ();
-    }
-  else
-    val = Modified_font_metric::make_scaled_font_metric (f, lookup_mag,
+  SCM val = Modified_font_metric::make_scaled_font_metric (f, lookup_mag,
                                                         font_encoding,
                                                         input_encoding);
 
index fb97fcf6f2436a5811fdba65212f866e8eaaee77..d44f9d3588a24c860113544ac3cd39475d71b966 100644 (file)
@@ -102,11 +102,14 @@ Score_engraver::initialize ()
 {
   Font_metric *fm = all_fonts_global->find_otf (MUSIC_FONT);
   if (!fm)
-    error (_f ("cannot find `%s'", MUSIC_FONT ".otf")
-          + "\n"
-          + _ ("Music font has not been installed properly.")
-          + _ ("Aborting"));
-
+    {
+      error (_f ("cannot find `%s'", MUSIC_FONT ".otf")
+              + "\n"
+              + _ ("Music font has not been installed properly.\n")
+              + _f ("Search path `%s'\n", global_path.to_string ().to_str0())
+              + _ ("Aborting"));       
+    }
+  
   if (!scm_is_string (ly_kpathsea_find_file (scm_makfrom0str ("ecrm10.pfa")))
       && (!scm_is_string (ly_kpathsea_find_file (scm_makfrom0str ("lmr10.pfb")))))
       error (_f ("cannot find `%s'", "ecrm10.pfa")
index eb8d47ef8f37cb1e619bc09a203741636cde7c04..b098b38af794f77a38fb428eb185d0c09cd7e4d4 100644 (file)
@@ -592,9 +592,9 @@ Stem::flag (Grob *me)
   return flag;
 }
 
-MAKE_SCHEME_CALLBACK (Stem,dim_callback,2);
+MAKE_SCHEME_CALLBACK (Stem,width_callback,2);
 SCM
-Stem::dim_callback (SCM e, SCM ax)
+Stem::width_callback (SCM e, SCM ax)
 {
   Axis a = (Axis) scm_to_int (ax);
   assert (a == X_AXIS);
@@ -714,9 +714,9 @@ Stem::print (SCM smob)
 /*
   move the stem to right of the notehead if it is up.
  */
-MAKE_SCHEME_CALLBACK (Stem, off_callback, 2);
+MAKE_SCHEME_CALLBACK (Stem, offset_callback, 2);
 SCM
-Stem::off_callback (SCM element_smob, SCM)
+Stem::offset_callback (SCM element_smob, SCM)
 {
   Grob *me = unsmob_grob (element_smob);
   Real r = 0.0;
index 5537069fd460033d77a24a1d6b11c54701884085..fa81ff3bd811b4ffa95fc6f68a01033c59c110c5 100644 (file)
 
 */
 
+
+/*
+  FIXME. Need to use markup. 
+ */
 struct Sustain_pedal
 {
 public:
@@ -48,7 +52,7 @@ Sustain_pedal::print (SCM smob)
 
   for (int i = 0; i < text.length (); i++)
     {
-      String idx ("pedal-");
+      String idx ("pedal.");
       if (text.cut_string (i, 3) == "Ped")
        {
          idx += "Ped";
index 47cfa06269548762ff90dcaab7ae1122289e4c36..6c7b0eff8dd8727da67a2496dae1e7fbb10d45f2 100644 (file)
@@ -14,7 +14,6 @@
 #include "warn.hh"
 #include "grob.hh"
 #include "font-interface.hh"
-#include "virtual-font-metric.hh"
 #include "output-def.hh"
 #include "modified-font-metric.hh"
 #include "ly-module.hh"
index f074f3a68ec5113ff760165fe3bf06f0b6f52ab3..cab2e673baaeb1b103d566f6222a7ae019582d7f 100644 (file)
   
  */
 
-#include "tuplet-bracket.hh"
+/*
+
+    TODO: quantise, we don't want to collide with staff lines.
+ (or should we be above staff?)
+
+  todo: handle breaking elegantly.
+*/
 
 #include <math.h>
 
+#include "tuplet-bracket.hh"
 #include "line-interface.hh"
 #include "beam.hh"
 #include "warn.hh"
@@ -297,12 +304,11 @@ Tuplet_bracket::make_bracket (Grob *me,   // for line properties.
   use first -> last note for slope, and then correct for disturbing
   notes in between.  */
 void
-Tuplet_bracket::calc_position_and_height (Grob*me,Real *offset, Real * dy) 
+Tuplet_bracket::calc_position_and_height (Grob*me, Real *offset, Real * dy) 
 {
   Link_array<Grob> columns =
     Pointer_group_interface__extract_grobs (me, (Grob*)0, "note-columns");
 
-
   SCM cols = me->get_property ("note-columns");
   Grob * commony = common_refpoint_of_list (cols, me, Y_AXIS);
   Grob * commonx = common_refpoint_of_list (cols, me, X_AXIS);  
@@ -495,7 +501,7 @@ Tuplet_bracket::after_line_breaking (SCM smob)
   else if (!scm_is_number (rp) && !scm_is_number (lp))
     {
       lp = scm_make_real (offset);
-      rp = scm_make_real (offset +dy);
+      rp = scm_make_real (offset + dy);
     }
 
   me->set_property ("left-position", lp);
@@ -537,7 +543,11 @@ Tuplet_bracket::add_column (Grob*me, Item*n)
 
 
 
-ADD_INTERFACE (Tuplet_bracket,"tuplet-bracket-interface",
-  "A bracket with a number in the middle, used for tuplets.",
-  "note-columns bracket-flare edge-height shorten-pair padding left-position right-position bracket-visibility number-visibility thickness direction");
+ADD_INTERFACE (Tuplet_bracket,
+              "tuplet-bracket-interface",
+              "A bracket with a number in the middle, used for tuplets.",
+              
+              "note-columns bracket-flare edge-height shorten-pair "
+              "padding left-position right-position bracket-visibility "
+              "number-visibility thickness direction");
 
diff --git a/lily/virtual-font-metric.cc b/lily/virtual-font-metric.cc
deleted file mode 100644 (file)
index a2fd658..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-/*   
-  virtual-font-metric.cc --  implement Virtual_font_metric
-
-source file of the GNU LilyPond music typesetter
-
-(c) 2002--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
- */
-
-#include "virtual-font-metric.hh"
-
-#include "all-font-metrics.hh"
-#include "stencil.hh"
-#include "output-def.hh"
-#include "warn.hh"
-
-/*
-  passing DEF is ughish. Should move into layoutdef?
-  */
-Virtual_font_metric::Virtual_font_metric (SCM font_list)
-{
-  font_list_ = SCM_EOL;
-  SCM *tail = &font_list_;
-
-  SCM mag = SCM_EOL;
-  SCM name_list = SCM_EOL;
-  SCM *name_tail = &name_list;
-  
-  for (SCM s = font_list; scm_is_pair (s); s = scm_cdr (s))
-    {
-      if (Font_metric *fm = unsmob_metrics (scm_car (s)))
-       {
-         *tail =  scm_cons (scm_car (s),SCM_EOL);
-         tail = SCM_CDRLOC (*tail);
-
-         if (!scm_is_number (mag))
-           /* Ugh.  */
-           mag = scm_cdr (fm->description_);
-
-         *name_tail = scm_cons (scm_car (fm->description_), SCM_EOL);
-         name_tail = SCM_CDRLOC (*name_tail);
-       }
-    }
-
-  description_ = scm_cons (name_list, mag);
-}
-
-Real 
-Virtual_font_metric::design_size () const
-{
-  return unsmob_metrics (scm_car (font_list_))-> design_size ();
-}
-
-void
-Virtual_font_metric::derived_mark ()const
-{
-  scm_gc_mark (font_list_);
-}
-
-int
-Virtual_font_metric::count () const
-{
-  int k = 0;
-  for (SCM s = font_list_; scm_is_pair (s); s = scm_cdr (s))
-      k += unsmob_metrics (scm_car (s))->count ();
-  return k;
-}
-
-Stencil
-Virtual_font_metric::find_by_name (String glyph) const
-{
-  Stencil m;  
-  for (SCM s = font_list_; m.is_empty () && scm_is_pair (s); s = scm_cdr (s))
-    m = unsmob_metrics (scm_car (s))->find_by_name (glyph);
-
-  return m;
-}
-
-Box
-Virtual_font_metric::get_ascii_char (int)  const
-{
-  programming_error ("Virtual font metric cannot be indexed by ASCII.");
-  return Box ();
-}
-
-Stencil
-Virtual_font_metric::get_ascii_char_stencil (int )  const
-{
-  programming_error ("Virtual font metric cannot be indexed by ASCII.");
-  return Stencil ();
-}
-
-Offset
-Virtual_font_metric::get_indexed_wxwy (int code)  const
-{
-  int total = 0;
-  for (SCM s = font_list_; scm_is_pair (s); s = scm_cdr (s))
-    {
-      Font_metric *fm = unsmob_metrics (scm_car (s));
-      if (code < total + fm->count ())
-       return fm->get_indexed_wxwy (code - total);
-      total += fm->count ();
-    }
-  return Offset (0,0);
-}
-
-Box
-Virtual_font_metric::get_indexed_char (int code)  const
-{
-  int total = 0;
-  for (SCM s = font_list_; scm_is_pair (s); s = scm_cdr (s))
-    {
-      Font_metric *fm = unsmob_metrics (scm_car (s));
-      if (code < total + fm->count ())
-       return fm->get_indexed_char (code - total);
-      total += fm->count ();
-    }
-  return Box ();
-}
-
-int 
-Virtual_font_metric::name_to_index (String glyph) const
-{
-  Stencil m;
-  int total = 0; 
-  for (SCM s = font_list_; m.is_empty () && scm_is_pair (s); s = scm_cdr (s))
-    {
-      Font_metric *m = unsmob_metrics (scm_car (s));
-      int k = m->name_to_index (glyph);
-      if (k >= 0)
-       return total + k;
-
-      total += m->count ();
-    }
-  return -1;
-}
-  
-Stencil
-Virtual_font_metric::get_indexed_char_stencil (int code)  const
-{
-  Stencil  m ;  
-  int total = 0;
-  
-  for (SCM s = font_list_; scm_is_pair (s); s = scm_cdr (s))
-    {
-      Font_metric *fm = unsmob_metrics (scm_car (s));
-      if (code < total + fm->count ())
-       {
-         /* Ugh.  */
-         m = fm->get_indexed_char_stencil (code - total);
-         break; 
-       }
-      total += fm->count ();
-    }
-  return m;
-}
-
-
-SCM
-Virtual_font_metric::get_font_list () const
-{
-  return font_list_;
-}
-
-LY_DEFINE (ly_make_virtual_font, "ly:make-virtual-font", 0, 0, 1,
-          (SCM args),
-          "Make a virtual font metric from @var{args}, "
-          "a list of font objects.")
-{
-  Virtual_font_metric *fm = new Virtual_font_metric (args);
-  return scm_gc_unprotect_object (fm->self_scm ());
-}
-
-String
-Virtual_font_metric::coding_scheme () const
-{
-  Font_metric *fm = unsmob_metrics (scm_car (font_list_));
-  return fm->coding_scheme ();
-}
index 7258626958cb1c370b4bee6d41a9d83013659417..250805566085744c7bf43145e34250317699fea8 100644 (file)
@@ -58,7 +58,10 @@ $(outdir)/%.otf: $(outdir)/%.pe
 $(outdir)/%.otf-table: $(outdir)/%.lisp
        cat $< $(subst parmesan,feta,$<) > $@
 
+$(outdir)/aybabtu.otf: $(outdir)/aybabtu.subfonts
 
+$(outdir)/aybabtu.subfonts: 
+        echo $(subst .mf,,$(wildcard feta-braces-[a-z].mf)) > $@
 
 $(PE_SCRIPTS):
        $(PYTHON) $(buildscript-dir)/gen-bigcheese-scripts.py --dir=$(outdir)
index ba5840bfbeea5ab17188227912cb041ccfcf5df1..393d6a372d3446d80c177900f0200bb5c685ae81 100644 (file)
@@ -25,11 +25,11 @@ mode_setup;
 
 
 
-save code;
+save code, braces_per_font;
 code := 64;
+braces_per_font := 64;
 
-
-def draw_brace (expr height_sharp, width_sharp, slt_sharp) =
+def draw_brace (expr height_sharp, width_sharp, slt_sharp, brace_number) =
 
        save pendir, height, width, thin, thick, slt;
        save penangle;
@@ -38,8 +38,8 @@ def draw_brace (expr height_sharp, width_sharp, slt_sharp) =
        slt# := slt_sharp;
 
 %% +1  is needed because fet_beginchar increments after dumping the strings.
-fet_beginchar ("brace number " & (decimal (code + 1)),
-               "brace" & decimal code)
+fet_beginchar ("brace number " & (decimal (brace_number)),
+               "brace" & decimal(brace_number))
 
        set_char_box (0, width#, height#/2, height#/2);
          
@@ -79,17 +79,20 @@ y := 10pt#;
 
 
 
+
 for i := 0 step 1 until font_count:
 
   %% We can't store more than 64 (65?) height dimensions in a TFM
   %% file, so we make small files.
+  save number;
+
+  number := braces_per_font * i;
 
   for j := 0 step 1 until 63:
     % message "l: "&decimal l;
     % note: define_pixels (x) multiplies x by hppp,
     % must never get bigger than infinity
     y := y + increment;
-
     if y > infinity/hppp:
       message "Resolution and/or magnification is too high";
       error please report: <bug-lilypond@gnu.org>;
@@ -103,8 +106,9 @@ for i := 0 step 1 until font_count:
     increment := x / 10;
     linethickness :=  min (0.5pt#, y/150);
     if i = font_count:
-      draw_brace (y, x, linethickness);
+      draw_brace (y, x, linethickness, number);
     fi
+    number := number + 1;
   endfor;
 endfor
   
index 45eaf03288f20a1c1dc3c330bcb7bc161e035eac..2adda3e4c4d101724cc9935a69abcc0a7be26abe 100644 (file)
        ;; The 'extreme case' minima
        (beamed-extreme-minimum-free-lengths . (2.0 1.25))
 
-       (X-offset-callbacks . (,Stem::off_callback))
-       (X-extent-callback . ,Stem::dim_callback)       
+       (X-offset-callbacks . (,Stem::offset_callback))
+       (X-extent-callback . ,Stem::width_callback)     
        (Y-extent-callback . ,Stem::height)
        (Y-offset-callbacks . (,Staff_symbol_referencer::callback))
        (meta . ((interfaces . (stem-interface font-interface item-interface ))))
index 1d20344a431477468c8040c5b9fcde460b207f84..58d1bcdf014ac960c972c4521baa8ee7c2f8cb42 100644 (file)
    'pre ""
    'post))
 
+
+(define-public (tex-font-command-raw name magnification)
+  (string-append
+   "magfont"
+   (string-encode-integer
+    (hash name 1000000))
+   "m"
+   (string-encode-integer
+    (inexact->exact (round (* 1000 magnification))))))
+
+(define-public (tex-font-command font)
+  (tex-font-command-raw
+   (ly:font-file-name font) (ly:font-magnification font)))
+
+
 (define (otf-font-load-command paper font)
   (let*
-      ((sub-fonts (ly:font-sub-fonts font))
-       (base-name (tex-font-command font)))
+      ((sub-fonts (ly:font-sub-fonts font)))
 
     (string-append
      (apply string-append
            (map
             (lambda (sub-name)
               (string-append
-               "\\font\\" (string-append base-name (digits->letters sub-name)) "="
-               sub-name 
+               "\\font\\" (tex-font-command-raw sub-name (ly:font-magnification font))
+               "=" sub-name
                " scaled "
                (ly:number->string (inexact->exact
                                    (round (* 1000
                                              (ly:font-magnification font)
                                              (ly:paper-outputscale paper)))))
                "%\n"))
-            sub-fonts)))
-
-    "\\def\\" (tex-font-command font) "{"
-    (apply string-append
-          (map (lambda (name)
-                 "\\def\\" (string-append base-name (digits->letters name))
-                 )
-    ))))
+            sub-fonts)))))
 
-(define-public (tex-font-command font)
-  (string-append
-   "magfont"
-   (string-encode-integer
-    (hashq (ly:font-file-name font) 1000000))
-   "m"
-   (string-encode-integer
-    (inexact->exact (round (* 1000 (ly:font-magnification font)))))))
 
 (define (simple-font-load-command paper font)
   (let* ((coding-alist (ly:font-encoding-alist font))
index 0f4f5b4f95972237d1baccfc3edfad398f656f33..615ca5f36aab838b2c3208661ccebef636491363 100644 (file)
 
 
 (define (named-glyph font name)
-  (string-append "\\" (tex-font-command font)
-                "\\"
-                (string-append
-;                (digits->letters (ly:font-name font))
-                 (regexp-substitute/global
-                  #f "[-\\._]"
-                  (digits->letters name)
-                  'pre ""
-                  'post))))
+  (let*
+      ((info  (ly:otf-font-glyph-info font name)))
+
+    (string-append "\\" (tex-font-command-raw
+                        (assoc-get 'subfont info)
+                        (ly:font-magnification font))
+                  "\\char" (number->string (assoc-get 'subfont-index info)))))
 
 (define (dashed-line thick on off dx dy)
   (embedded-ps (list 'dashed-line  thick on off dx dy)))
index 5baaf1c8b7f458a22018651332f597e68b6eca37..3ec1c8024f1457646345d87e0190ace38e9e14e0 100644 (file)
      Staff_symbol::print
      Staff_symbol_referencer::callback
      Stem::before_line_breaking
-     Stem::dim_callback
+     Stem::width_callback
      Stem::height
-     Stem::off_callback
+     Stem::offset_callback
      Stem::print
      Stem_tremolo::height
      Stem_tremolo::print