]> git.donarmstrong.com Git - lilypond.git/commitdiff
release: 1.3.100 release/1.3.100
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 29 Oct 2000 23:54:34 +0000 (00:54 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 29 Oct 2000 23:54:34 +0000 (00:54 +0100)
===========

* Tweaks of .scm font-selection.

* Rewrote font management of Score_element and Paper_def.

* Introduced outputscale: internally do computation in terms of
outputscale.  Prepare to deprecate staffspace internally.  Rewrote
.scm side of font selectioning.

1.3.99.j

68 files changed:
CHANGES
NEWS
VERSION
input/test/noteheadstyle.ly
lily/afm.cc
lily/all-font-metrics.cc
lily/arpeggio.cc
lily/bar.cc
lily/chord-name-engraver.cc
lily/chord-name.cc
lily/clef-item.cc
lily/crescendo.cc
lily/dots.cc
lily/font-interface.cc [new file with mode: 0644]
lily/font-metric.cc
lily/grace-align-item.cc
lily/include/afm.hh
lily/include/all-font-metrics.hh
lily/include/font-interface.hh [new file with mode: 0644]
lily/include/font-metric.hh
lily/include/paper-def.hh
lily/include/score-element.hh
lily/include/stem.hh
lily/include/tfm.hh
lily/key-item.cc
lily/line-of-score.cc
lily/local-key-item.cc
lily/molecule.cc
lily/multi-measure-rest.cc
lily/note-head.cc
lily/paper-def.cc
lily/paper-outputter.cc
lily/paper-score.cc
lily/piano-pedal-engraver.cc
lily/rest.cc
lily/rhythmic-head.cc
lily/scaled-font-metric.cc
lily/score-element.cc
lily/script.cc
lily/separating-group-spanner.cc
lily/slur.cc
lily/span-bar.cc
lily/stem.cc
lily/sustain-pedal.cc
lily/system-start-delimiter.cc
lily/text-item.cc
lily/text-spanner.cc
lily/tfm.cc
lily/time-signature.cc
lily/tuplet-spanner.cc
lily/volta-spanner.cc
ly/params.ly
make/out/lilypond.lsm
make/out/lilypond.spec
mf/feta-din12.mf [deleted file]
mf/feta-din14.mf [deleted file]
mf/feta-din3.mf [deleted file]
mf/feta-din6.mf [deleted file]
mf/feta-nummer12.mf [deleted file]
mf/feta-nummer14.mf [deleted file]
mf/feta-nummer3.mf [deleted file]
mf/feta-nummer6.mf [deleted file]
scm/ascii-script.scm [new file with mode: 0644]
scm/element-descriptions.scm
scm/font.scm
scm/lily.scm
scripts/abc2ly.py
tex/lily-ps-defs.tex

diff --git a/CHANGES b/CHANGES
index 9f8dc8ce2cd7ccdc47335fd0e6a94a35a7f9160b..4f26feaf91967c4253988248a9926ffdd9404296 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,49 +1,15 @@
---- ../lilypond-1.3.99.jcn1/CHANGES    Wed Oct 25 21:33:46 2000
-++ b/CHANGES   Sat Oct 28 15:44:16 2000
-@@ -1,3 +1,16 @@
-1.3.99.jcn2
-===========
-
-* Font initialisation and markup translation fixes.
-
 1.3.99.hwn2
 ===========
 
-* tweaks of .scm font-selection. 
+* Tweaks of .scm font-selection. 
 
 * Rewrote font management of Score_element and Paper_def.
 
+* Introduced outputscale: internally do computation in terms of
+outputscale.  Prepare to deprecate staffspace internally.  Rewrote
+.scm side of font selectioning. 
 
- 1.3.99.jcn1
- ===========
- --- ../lilypond-1.3.99/CHANGES        Wed Oct 25 07:03:07 2000
-++ b/CHANGES   Fri Oct 27 20:28:15 2000
-@@ -1,3 +1,25 @@
-1.3.99.lec1
-===========
-* fixes to abc2ly:
-
-       puts text above rather than below the staff.
-
-       interprets %%MIDI nobarlines (this is an esoteric change, but
-       I need it to use the program at all -- it assumes that
-       accidentals are not persistent.
-
-       Interprets the -8va tenor g clef.
-
-       Fix to previously claimed fix for setting L: before M:
-
-       Uses current rather than deprecated syntax for \property
-       Staff.TimeSignature
-
-       Allows a space between key letter and mode.
-
-       Fix to translation table for :|:
-
-       
- 1.3.98.jcn2
- ===========
- 1.3.99.jcn1
+1.3.99.jcn1
 ===========
 
 * Made several font size and initialisation fixes.
diff --git a/NEWS b/NEWS
index de0d3f6cf14e66dc88cd45b5f0e3b62700b231a8..f83626e69ae744888b501b7959b9d7eaf5acde80 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,8 @@ internals: LilyPond is smaller, cleaner, more flexible, etc.
 
  - Improved robustness: Lily almost never crashes.
 
+* Rewritten font selection, Latex-NFSS like
+
 * Piano pedal support, Arpeggios
 
 * MIDI: dynamics, tempo changes
diff --git a/VERSION b/VERSION
index 6d8d7dab120575d129ca01d0fb8f29073f899317..b7c53f15f631170ae0ed3dd4b3608f9762bdc21b 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,8 +1,8 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=3
-PATCH_LEVEL=99
-MY_PATCH_LEVEL=jcn3
+PATCH_LEVEL=100
+MY_PATCH_LEVEL=
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
index 70e879a476959f3a16c1ce8789f3fc82d7c778ca..0db7a577c9aaa5a45e3267f9a81a7218fc78b783 100644 (file)
@@ -1,43 +1,49 @@
+
 \score { \notes \relative c{
-c''4 c2 c8  c16 c16 c1 c\breve 
-\property Voice.noteHeadStyle = #'diamond
+% anyone wanna pop?
+c''4 c2 c8  c16 c16 c1 c\breve
+\property Voice.NoteHead \push #'style = #'diamond
 c4 c2 c8  c16 c16  c1 c\breve
-\property Voice.noteHeadStyle = #'transparent
+\property Voice.NoteHead \push #'style = #'transparent
 c4 c2 c8  c16 c16  c1 c\breve
-\property Voice.noteHeadStyle = #'cross
+\property Voice.NoteHead \push #'style = #'cross
 c4 c2 c8  c16 c16  c1 c\breve
-\property Voice.noteHeadStyle = #'mensural
+\property Voice.NoteHead \push #'style = #'mensural
 c4 c2 c8  c16 c16  c1 c\breve c\longa
-\property Voice.noteHeadStyle = #'harmonic
+\property Voice.NoteHead \push #'style = #'harmonic
 c4 c2 c8  c16 c16  c1 c\breve
-\property Voice.noteHeadStyle = #'baroque
+\property Voice.NoteHead \push #'style = #'baroque
 c4 c2 c8  c16 c16  c1 c\breve c\longa
 
+
    \context Voice <
     \context Thread = TA
-      { \property Thread.noteHeadStyle = #'cross
-        \property Voice.verticalDirection = \up c16} 
+      {
+        \property Thread.NoteHead \push #'style = #'cross
+        \property Voice.Stem \push #'direction = #1
+        c16
+       }
     \context Thread = TB
-      { \property Thread.noteHeadStyle = #'default a16  }
-    
+      { \property Thread.NoteHead \push #'style = #'default a16  }
+
     \context Thread = TC
-      { \property Thread.noteHeadStyle = #'mensural d16 }
-    
+      { \property Thread.NoteHead \push #'style = #'mensural d16 }
+
   >
 
-  
+
    \context Voice <\context Thread = TA {
-   \property Thread.noteHeadStyle = #'default
+   \property Thread.NoteHead \push #'style = #'default
    c4 c4 }
 \context Thread = TB {
-  \property Thread.noteHeadStyle = #'mensural
+   \property Thread.NoteHead \push #'style = #'mensural
   c'4 \stemDown c
 } >
 
 }
 
     \paper {
-       
-    }
+
+
+}
 }
-\version "1.3.96"; 
index 7fcca1bd6a072c96c6a8ae81267282fdf4bb6f6f..1efee6721313570c77390e7045b436721d0fbbd1 100644 (file)
@@ -74,7 +74,7 @@ Adobe_font_metric::find_char_metric (String nm, bool warn) const
 
 
 Box
-Adobe_font_metric::get_char (int code, Real mag) const
+Adobe_font_metric::get_char (int code) const
 {
   AFM_CharMetricInfo const
     * c =  find_ascii_metric (code,false);
@@ -82,7 +82,6 @@ Adobe_font_metric::get_char (int code, Real mag) const
   if (c)
     b = afm_bbox_to_box (c->charBBox);                 
 
-  b.scale (mag);
   return b;
 }
 
@@ -96,7 +95,7 @@ read_afm_file (String nm)
 
   if (ok)
     {
-      error (_f ("Error parsing AFM file: %s", nm.ch_C ()));
+      error (_("Error parsing AFM file"));
       exit (2);
     }
   fclose (f);
@@ -119,8 +118,11 @@ Adobe_font_metric::~Adobe_font_metric ()
   AFM_free (font_inf_);
 }
 
+/*
+  return a molecule, without fontification 
+ */
 Molecule
-Adobe_font_metric::find_by_name (String s, Real mag) const
+Adobe_font_metric::find_by_name (String s) const
 {
   AFM_CharMetricInfo const *cm = find_char_metric (s, false);
 
@@ -135,8 +137,8 @@ Adobe_font_metric::find_by_name (String s, Real mag) const
                      gh_int2scm (cm->code),
                      SCM_UNDEFINED));
   
-  at= fontify_atom ((Font_metric*)this, at);
+  //  at= fontify_atom ((Font_metric*)this, at);
   Box b = afm_bbox_to_box (cm->charBBox);
-  b.scale (mag);
+
   return Molecule (b, at);
 }
index 795664edf4136f20779d72849611e1ad97a1bbc5..2d3f73140e22fcb4c46138f457a0395bf8dbcb1e 100644 (file)
@@ -28,7 +28,6 @@ All_font_metrics::All_font_metrics (String path)
 {
   afm_p_dict_ = new Scheme_hash_table;
   tfm_p_dict_ = new Scheme_hash_table;
-  scaled_p_dict_ = new Scheme_hash_table;
   
   search_path_.parse_path (path);
 }
@@ -37,7 +36,6 @@ All_font_metrics::~All_font_metrics ()
 {
   scm_unprotect_object (afm_p_dict_->self_scm ());
   scm_unprotect_object (tfm_p_dict_->self_scm ());
-  scm_unprotect_object (scaled_p_dict_->self_scm ());
 }
 
 Adobe_font_metric *
@@ -45,6 +43,8 @@ All_font_metrics::find_afm (String name)
 {
   SCM sname = ly_symbol2scm (name.ch_C ());
 
+  SCM name_str = gh_str02scm (name.ch_C ());
+
   SCM val;
   
   if (!afm_p_dict_->try_retrieve  (sname, &val))
@@ -68,7 +68,7 @@ All_font_metrics::find_afm (String name)
        progress_indication ("[" + path);
       val = read_afm_file (path);
 
-      unsmob_metrics (val)->name_ = sname;
+      unsmob_metrics (val)->description_ = gh_cons (name_str, gh_double2scm (1.0));
 
       if (verbose_global_b)
        progress_indication ("]");
@@ -81,30 +81,12 @@ All_font_metrics::find_afm (String name)
   return dynamic_cast<Adobe_font_metric*> (unsmob_metrics (val));
 }
 
-Scaled_font_metric * 
-All_font_metrics::find_scaled (String nm, Real m)
-{
-  String index =  nm + "@" + to_str (m);
-  SCM sname = ly_symbol2scm (index.ch_C ());
-
-  SCM val;
-
-  if (!scaled_p_dict_->try_retrieve  (sname, &val))
-    {
-      Font_metric *f = find_font (nm);
-      val =  Scaled_font_metric::make_scaled_font_metric (f, m);
-      scaled_p_dict_->set (sname, val);
-
-      scm_unprotect_object (val);
-    }
-
-  return dynamic_cast<Scaled_font_metric*> (unsmob_metrics (val));
-}
 
 Tex_font_metric *
 All_font_metrics::find_tfm (String name)
 {
   SCM sname = ly_symbol2scm (name.ch_C ());
+  SCM name_str = gh_str02scm (name.ch_C ());
 
   SCM val;
   if (!tfm_p_dict_->try_retrieve (sname, &val))
@@ -129,7 +111,7 @@ All_font_metrics::find_tfm (String name)
       if (verbose_global_b)
        progress_indication ("]");
 
-      unsmob_metrics (val)->name_ = sname;
+      unsmob_metrics (val)->description_ = gh_cons (name_str, gh_double2scm (1.0));
       tfm_p_dict_->set (sname, val);
 
       scm_unprotect_object (val);
@@ -143,9 +125,7 @@ All_font_metrics::find_tfm (String name)
 Font_metric *
 All_font_metrics::find_font (String name)
 {
-  Font_metric * f=0;
-
-  f= find_afm (name);
+  Font_metric * f= find_afm (name);
   if (f)
     return f;
 
@@ -178,32 +158,4 @@ All_font_metrics::find_font (String name)
   return 0;
 }
 
-SCM
-All_font_metrics::font_descriptions () const
-{
-  SCM l[] = {0,0,0};
 
-  l[0] = afm_p_dict_->to_alist ();
-  l[1] = tfm_p_dict_->to_alist ();
-  l[2] = scaled_p_dict_->to_alist ();  
-
-  SCM list = SCM_EOL;
-  for (int i=0; i < 3; i++)
-    {
-      for (SCM s = l[i];  gh_pair_p (s); s = gh_cdr (s))
-       {
-         Font_metric * fm = unsmob_metrics (gh_cdar (s));
-
-         list = gh_cons (fm->description (), list);
-       }
-    }
-  return list;
-}
-
-
-
-Font_metric*
-find_font (String name)
-{
-  return all_fonts_global_p->find_font (name);
-}
index aebc96b8306edc5fbbe28ed4f7549bc44e49af9d..1c2d79d14dc11fbbeeb2fb6db4b4a8aa18f54560 100644 (file)
@@ -8,13 +8,13 @@
 
 #include "molecule.hh"
 #include "paper-def.hh"
-#include "font-metric.hh"
 #include "arpeggio.hh"
 #include "score-element.hh"
 #include "stem.hh"
 #include "staff-symbol-referencer.hh"
 #include "staff-symbol.hh"
 #include "warn.hh"
+#include "font-interface.hh"
 
 bool
 Arpeggio::has_interface (Score_element* me)
@@ -68,7 +68,7 @@ Arpeggio::brew_molecule (SCM smob)
     }
   
   Molecule mol;
-  Molecule arpeggio = me->get_default_font ()->find_by_name ("scripts-arpeggio");
+  Molecule arpeggio = Font_interface::get_default_font (me)->find_by_name ("scripts-arpeggio");
 
   Real y = heads[LEFT];
   while (y < heads[RIGHT])
@@ -93,7 +93,7 @@ Arpeggio::width_callback (SCM smob, SCM axis)
   Score_element * me = unsmob_element (smob);
   Axis a = (Axis)gh_scm2int (axis);
   assert (a == X_AXIS);
-  Molecule arpeggio = me->get_default_font ()->find_by_name ("scripts-arpeggio");
+  Molecule arpeggio = Font_interface::get_default_font (me)->find_by_name ("scripts-arpeggio");
 
   return ly_interval2scm (arpeggio.extent (X_AXIS) * 1.5);
 }
index 3305fd945fab23b784036a100ff1bbb8bc0ca8bd..9da7babb50209a9a450a1ce63c436ffaab9be55f 100644 (file)
@@ -15,7 +15,7 @@
 #include "string.hh"
 #include "molecule.hh"
 #include "paper-def.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
 #include "debug.hh"
 #include "all-font-metrics.hh"
 #include "item.hh"
@@ -61,7 +61,7 @@ Bar::compound_barline (Score_element*me, String str, Real h)
   
   Molecule thin = simple_barline (me, hair, h);
   Molecule thick = simple_barline (me, fatline, h);
-  Molecule colon = me->get_default_font ()->find_by_name ("dots-repeatcolon");  
+  Molecule colon = Font_interface::get_default_font (me)->find_by_name ("dots-repeatcolon");  
 
   Molecule m;
   
index b49f03bce86008cf6264f1506ce4d36caf25d402..8729cb57a2a08b420e4544661e000daef6a3edfb 100644 (file)
@@ -11,7 +11,7 @@
 #include "chord.hh"
 #include "musical-request.hh"
 #include "paper-def.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
 #include "paper-def.hh"
 #include "main.hh"
 #include "dimensions.hh"
index 7f42c254078fea83918ff31f478f439252a87413..2b17c561b35a2af5f3d8e15a739d07b9b910ffe6 100644 (file)
@@ -9,7 +9,7 @@
 #include "chord-name.hh"
 #include "molecule.hh"
 #include "paper-def.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
 #include "score-element.hh"
 #include "paper-column.hh"
 #include "line-of-score.hh"
index 4985ac69b9d1aede03e358f5f088cc979b722368..a96275bb60e3b04352a843b86043351a6b8c37b1 100644 (file)
@@ -11,7 +11,7 @@
 #include "string.hh"
 #include "molecule.hh"
 #include "item.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
 
 /*
 FIXME: should use symbol for #'style.
@@ -76,7 +76,7 @@ Clef::brew_molecule (SCM smob)
   SCM glyph = sc->get_elt_property ("glyph");
   if (gh_string_p (glyph))
     {
-      return sc->get_default_font ()->find_by_name (String (ly_scm2string (glyph))).create_scheme ();
+      return Font_interface::get_default_font (sc)->find_by_name (String (ly_scm2string (glyph))).create_scheme ();
     }
   else
     {
index 2f7535f6f8c094dc271771e16f158fe8b86e9bee..be54a96e62e0057a377b78697d250dc77144ec3b 100644 (file)
@@ -9,7 +9,7 @@
 #include "molecule.hh"
 #include "crescendo.hh"
 #include "spanner.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
 #include "dimensions.hh"
 #include "paper-def.hh"
 #include "debug.hh"
index 4e9dc5659a85050cdc5266d16057ab83fc7e4c53..28ef9a5526cd1f688be0d42dba1cf092cf234a9b 100644 (file)
@@ -10,7 +10,7 @@
 #include "item.hh"
 #include "molecule.hh"
 #include "paper-def.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
 #include "lookup.hh"
 #include "staff-symbol-referencer.hh"
 #include "directional-element-interface.hh"
@@ -54,7 +54,7 @@ Dots::brew_molecule (SCM d)
 
   if (gh_number_p (c))
     {
-      Molecule d = sc->get_default_font ()->find_by_name (String ("dots-dot"));
+      Molecule d = Font_interface::get_default_font (sc)->find_by_name (String ("dots-dot"));
       Real dw = d.extent (X_AXIS).length ();
       //      d.translate_axis (-dw, X_AXIS);
 
diff --git a/lily/font-interface.cc b/lily/font-interface.cc
new file mode 100644 (file)
index 0000000..3255c8b
--- /dev/null
@@ -0,0 +1,45 @@
+/*   
+  font-interface.cc --  implement Font_interface
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#include "all-font-metrics.hh"
+#include "font-metric.hh"
+#include "font-interface.hh"
+#include "score-element.hh"
+#include "paper-def.hh"
+
+/*
+  todO : split up this func, reuse in text_item? 
+ */
+Font_metric *
+Font_interface::get_default_font (Score_element*me)
+{
+  Font_metric * fm =  unsmob_metrics (me->get_elt_property ("font"));
+  if (fm)
+    return fm;
+
+  SCM ss = me->paper_l ()->style_sheet_;
+
+  SCM proc = gh_cdr (scm_assoc (ly_symbol2scm ("properties-to-font"),
+                               ss));
+
+  SCM fonts = gh_cdr (scm_assoc (ly_symbol2scm ("fonts"), ss));
+  SCM defaults = gh_cdr (scm_assoc (ly_symbol2scm ("font-defaults"),
+                                   ss));
+
+  assert (gh_procedure_p (proc));
+  SCM font_name = gh_call2 (proc, fonts,
+                           gh_list (me->mutable_property_alist_,
+                                    me->immutable_property_alist_,
+                                    defaults,
+                                    SCM_UNDEFINED));
+
+  fm = me->paper_l ()->find_font (font_name, 1.0);
+  me->set_elt_property ("font", fm->self_scm ());
+  return fm;
+}
index 08a27382ce9eb1934a5069f327f0a46d60aba669..6eb97a0c01c027c1a5996f27bdac4f0f68bddd6f 100644 (file)
@@ -17,7 +17,7 @@
 #include "string.hh"
 
 Box
-Font_metric::text_dimension (String text, Real mag) const
+Font_metric::text_dimension (String text) const
 {
   Interval ydims;
   Real w=0.0;
@@ -39,11 +39,11 @@ Font_metric::text_dimension (String text, Real mag) const
          break;
        
        default: 
-         Box b = get_char ((unsigned char)text[i],mag);
+         Box b = get_char ((unsigned char)text[i]);
          
          // Ugh, use the width of 'x' for unknown characters
          if (b[X_AXIS].length () == 0) 
-           b = get_char ((unsigned char)'x',mag);
+           b = get_char ((unsigned char)'x');
          
          w += b[X_AXIS].length ();
          ydims.unite (b[Y_AXIS]);
@@ -58,11 +58,11 @@ Font_metric::text_dimension (String text, Real mag) const
 
 
 Box
-Scaled_font_metric::text_dimension (String t,Real mag) const
+Scaled_font_metric::text_dimension (String t) const
 {
   Box b (orig_l_->text_dimension (t));
 
-  b.scale (magnification_f_ * mag);
+  b.scale (magnification_f_);
   return b;
 }
 
@@ -72,7 +72,7 @@ Font_metric::~Font_metric ()
 
 Font_metric::Font_metric ()
 {
-  name_ = SCM_EOL;
+  description_ = SCM_EOL;
 
   smobify_self ();
 }
@@ -83,23 +83,17 @@ Font_metric::Font_metric (Font_metric const &)
 
 
 Box 
-Font_metric::get_char (int, Real )const
+Font_metric::get_char (int )const
 {
   return Box (Interval(0,0),Interval (0,0));
 }
 
-SCM
-Font_metric::description () const
-{
-  return gh_cons (name_, gh_int2scm (0));
-}
-
 
 SCM
 Font_metric::mark_smob (SCM s)
 {
   Font_metric * m = (Font_metric*) SCM_CELL_WORD_1(s);
-  return m->name_;
+  return m->description_;
 }
 
 int
@@ -107,7 +101,7 @@ Font_metric::print_smob (SCM s, SCM port, scm_print_state * )
 {
   Font_metric *m = unsmob_metrics (s);
   scm_puts ("#<Font_metric ", port);
-  scm_display (m->name_, port);
+  scm_write (m->description_, port);
   scm_puts (">", port);
   return 1;
 }
@@ -119,7 +113,10 @@ IMPLEMENT_DEFAULT_EQUAL_P(Font_metric);
 IMPLEMENT_TYPE_P (Font_metric, "font-metric?");
 
 Molecule
-Font_metric::find_by_name (String, Real mag ) const
+Font_metric::find_by_name (String) const
 {
   assert (false);
 }
+
+
+
index 8d9cbf9ddca477ae3f20df7a90c77f7856f62d62..8adf61ba584b789128aa9278f1d62264a72ade82 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "grace-align-item.hh"
 #include "align-interface.hh"
-#include "font-metric.hh"
+
 #include "paper-column.hh"
 #include "paper-def.hh"
 
index 7220978207af5ba2cb3fad7c5818d4d8fcfdff22..79d7461f9812649d72840acdd9dc188de2a8bc02 100644 (file)
@@ -22,7 +22,7 @@ struct Adobe_font_metric : Font_metric
 {
   AFM_Font_info * font_inf_;
 
-  Box get_char (int, Real mag =1.0) const;
+  virtual Box get_char (int) const;
   AFM_CharMetricInfo const *find_char_metric (String name, bool warn=true) const;
   AFM_CharMetricInfo const *find_ascii_metric (int, bool warn=true) const;  
 
@@ -34,7 +34,7 @@ protected:
   Array<int> ascii_to_metric_idx_;
   Dictionary<int> name_to_metric_dict_;
 
-  virtual Molecule find_by_name (String, Real mag = 1.0) const;
+  virtual Molecule find_by_name (String) const;
 
   Adobe_font_metric (AFM_Font_info*);
 };
index ebfd2a2224942679c11cc4d4ba2dda07447234fe..cd3eb17fa4b9a99ce7e4e23e20a5498203c56720 100644 (file)
@@ -21,22 +21,18 @@ class All_font_metrics
 {
   Scheme_hash_table *afm_p_dict_;
   Scheme_hash_table *tfm_p_dict_;
-  Scheme_hash_table *scaled_p_dict_;
-  
   File_path search_path_;
 public:
   ~All_font_metrics ();  
   Adobe_font_metric *find_afm (String name);
   Tex_font_metric *find_tfm (String);
   Font_metric *find_font (String name);  
-  Scaled_font_metric* find_scaled (String , Real);
+
   
   All_font_metrics (String search_path);
   
   SCM font_descriptions () const;
 };
 
-Font_metric * find_font (String name);
-
 #endif /* ALL_FONTS_HH */
 
diff --git a/lily/include/font-interface.hh b/lily/include/font-interface.hh
new file mode 100644 (file)
index 0000000..0ce2620
--- /dev/null
@@ -0,0 +1,21 @@
+/*   
+  font-interface.hh -- declare Font_interface
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#ifndef FONT_INTERFACE_HH
+#define FONT_INTERFACE_HH
+
+#include "lily-proto.hh"
+#include "font-metric.hh"
+
+struct Font_interface
+{
+  static Font_metric * get_default_font (Score_element*); 
+};
+
+#endif /* FONT_INTERFACE_HH */
index e14ebb4e147d0b45197b12608fef1b2863988f8a..5844d58065402ab43e1bf4aba111efd6eddf8a71 100644 (file)
 struct Font_metric
 {
 public:
-  SCM name_;
-  virtual SCM description () const;
-  virtual Box get_char (int ascii, Real mag) const;
-  virtual Box text_dimension (String, Real mag = 1.0)  const;
-  virtual Molecule find_by_name (String, Real mag = 1.0) const;
+  SCM description_;
+
+  virtual Box get_char (int ascii) const;
+  virtual Box text_dimension (String)  const;
+  virtual Molecule find_by_name (String) const;
 
   DECLARE_SMOBS(Font_metric,);
 private:
@@ -32,11 +32,13 @@ protected:
 };
 
 
+/*
+  Perhaps junk this, and move iface to paper_def? 
+ */
 struct Scaled_font_metric : public Font_metric
 {
-  virtual SCM description () const;
-  virtual Box text_dimension (String, Real) const;
-  virtual Molecule find_by_name (String, Real) const;
+  virtual Box text_dimension (String) const;
+  virtual Molecule find_by_name (String) const;
   static SCM make_scaled_font_metric (Font_metric*, Real);
 protected:
   Font_metric *orig_l_;
index 11f4ab4224de79aea60f6812fbbf6530c0b975a7..7c569fd7adcb6c4c18ce3704cee759594a0a97fd 100644 (file)
@@ -50,9 +50,10 @@ class Paper_def : public Music_output_def
 protected:
   VIRTUAL_COPY_CONS(Music_output_def);
 
+  Protected_scm scaled_fonts_;
 public:    
   Protected_scm style_sheet_;
-  
+  SCM font_descriptions ()const;
   virtual ~Paper_def ();
   static int default_count_i_;
   /*
@@ -73,6 +74,8 @@ public:
   Paper_stream* paper_stream_p () const;
   String base_output_str () const;
 
+  Font_metric * find_font (SCM name, Real mag);
+  
   // urg
   friend int yyparse (void*);
 };
index 61eb4d13ec9eee2958fb98fff629663be8252a42..59e4a49e5290406cc754b203a60b0b35d4952086 100644 (file)
@@ -33,8 +33,6 @@ typedef void (Score_element::*Score_element_method_pointer) (void);
 */
 class Score_element  {
 public:
-  Font_metric * get_default_font ()const;
-  
   SCM immutable_property_alist_;
   SCM mutable_property_alist_;
   Score_element *original_l_;
index dfc939ab712d6ad1e5debda9d62d32c0a2c96d37..200ce735927c4b6b140eecb77a6f24f296a4b3c3 100644 (file)
@@ -10,6 +10,7 @@
 #include "lily-proto.hh"
 #include "lily-guile.hh"
 #include "stem-info.hh"
+#include "drul-array.hh"
 
 class Stem 
 {
index 12869dcb60203a0f3236fb19aa9c9357dc1c2d79..22e17c87cd14327aea5e47d6683d01517e04317b 100644 (file)
@@ -150,7 +150,7 @@ class Tex_font_metric : public Font_metric
 public:
   static  SCM make_tfm (String filename);
 
-  Box get_char (int,Real = 1.0) const;
+  Box get_char (int) const;
   Tex_font_char_metric const *find_ascii (int ascii, bool warn=true) const;
 
   String str () const;
index 5960c19696ad0b404fd06972dc70862132945730..2bc9024dfe955b9057e1659597417d10af599579 100644 (file)
@@ -12,7 +12,7 @@
 #include "key-item.hh"
 #include "molecule.hh"
 #include "paper-def.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
 #include "staff-symbol-referencer.hh"
 #include "lookup.hh"
 
@@ -90,7 +90,7 @@ Key_item::brew_molecule (SCM smob)
   for (SCM s = newas; gh_pair_p (s); s = gh_cdr (s))
     {
       int a = gh_scm2int (gh_cdar (s));
-      Molecule m = me->get_default_font ()->find_by_name ("accidentals-" + to_str (a));
+      Molecule m = Font_interface::get_default_font (me)->find_by_name ("accidentals-" + to_str (a));
       m.translate_axis (calculate_position(me, gh_car (s)) * inter, Y_AXIS);
       mol.add_at_edge (X_AXIS, LEFT, m, 0);
     }
@@ -122,7 +122,7 @@ Key_item::brew_molecule (SCM smob)
                
          if (found == SCM_EOL || gh_cdr (found) != gh_cdar (old))
            {
-              Molecule m =me->get_default_font ()->find_by_name ("accidentals-0");
+              Molecule m =Font_interface::get_default_font (me)->find_by_name ("accidentals-0");
 
               m.translate_axis (calculate_position (me, gh_car (old)) * inter, Y_AXIS);
               mol.add_at_edge (X_AXIS, LEFT, m,0);     
index 91045bc1f905be4134415ef0622f33980748ad8c..df4ba207eae944c5954fa83dc02d802e5d8cc9ee 100644 (file)
@@ -310,7 +310,7 @@ Line_of_score::post_processing (bool last_line)
   /*
     font defs;
    */
-  SCM font_names = ly_quote_scm (all_fonts_global_p->font_descriptions ());  
+  SCM font_names = ly_quote_scm (paper_l()->font_descriptions ());  
   output_scheme (gh_list (ly_symbol2scm ("define-fonts"),
                                        font_names,
                                        SCM_UNDEFINED));
index ba372c1ec95c409921973e43bf4e56267473b37d..69314d50fd74864b0e0879b0a44f070dea3e2347 100644 (file)
@@ -8,7 +8,7 @@
 #include "local-key-item.hh"
 #include "molecule.hh"
 #include "staff-symbol-referencer.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
 #include "paper-def.hh"
 #include "musical-request.hh"
 #include "rhythmic-head.hh"
@@ -60,8 +60,8 @@ Local_key_item::add_pitch (Score_element*me, Musical_pitch p, bool cautionary, b
 Molecule
 Local_key_item::parenthesize (Score_element*me, Molecule m)
 {
-  Molecule open = me->get_default_font ()->find_by_name (String ("accidentals-("));
-  Molecule close = me->get_default_font ()->find_by_name (String ("accidentals-)"));
+  Molecule open = Font_interface::get_default_font (me)->find_by_name (String ("accidentals-("));
+  Molecule close = Font_interface::get_default_font (me)->find_by_name (String ("accidentals-)"));
   m.add_at_edge(X_AXIS, LEFT, Molecule(open), 0);
   m.add_at_edge(X_AXIS, RIGHT, Molecule(close), 0);
 
@@ -111,12 +111,12 @@ Local_key_item::brew_molecule (SCM smob)
       Real dy = (gh_number_p (c0) ? gh_scm2int (c0) : 0 + p.notename_i_)
        * note_distance;
       
-      Molecule acc (me->get_default_font ()->find_by_name (String ("accidentals-")
+      Molecule acc (Font_interface::get_default_font (me)->find_by_name (String ("accidentals-")
                                               + to_str (p.accidental_i_)));
       
       if (scm_memq (ly_symbol2scm ("natural"), gh_car (s)) != SCM_BOOL_F)
        {
-         Molecule prefix = me->get_default_font ()->find_by_name (String ("accidentals-0"));
+         Molecule prefix = Font_interface::get_default_font (me)->find_by_name (String ("accidentals-0"));
          acc.add_at_edge(X_AXIS, LEFT, Molecule(prefix), 0);
        }
 
index c0d1b48748395ae967df0f8d02be4bc26c238e9c..240a8aec7242a6e2ae37a4ee45199acbdcf4c7e2 100644 (file)
@@ -9,7 +9,7 @@
 #include <math.h>
 #include <libc-extension.hh>
 
-#include "font-metric.hh"
+#include "font-metric.hh" 
 #include "dimensions.hh"
 #include "interval.hh"
 #include "string.hh"
@@ -125,8 +125,11 @@ Molecule::empty_b () const
 SCM
 fontify_atom(Font_metric * met, SCM f)
 {
-  return  gh_list (ly_symbol2scm ("fontify"),
-                  ly_quote_scm (met->description ()), f, SCM_UNDEFINED);
+  if (f == SCM_EOL)
+    return f;
+  else
+    return  gh_list (ly_symbol2scm ("fontify"),
+                    ly_quote_scm (met->description_), f, SCM_UNDEFINED);
 }
 
 SCM
index e8d4565e2eccf3094f628429589bd18c2304b70e..ceb5657642211ad4eace1b44b4e933e6f177add1 100644 (file)
@@ -11,7 +11,7 @@
 #include "debug.hh"
 #include "paper-def.hh"
 #include "paper-column.hh" // urg
-#include "font-metric.hh"
+#include "font-interface.hh"
 #include "rest.hh"
 #include "molecule.hh"
 #include "misc.hh"
@@ -111,7 +111,7 @@ Multi_measure_rest::brew_molecule (SCM smob)
          Real pad = s.empty_b ()
            ? 0.0 : gh_scm2double (me->get_elt_property ("padding")) * staff_space;
 
-         Molecule r (me->get_default_font ()->find_by_name ("rests-" + to_str (k)));
+         Molecule r (Font_interface::get_default_font (me)->find_by_name ("rests-" + to_str (k)));
          if (k == 0)
            r.translate_axis (staff_space, Y_AXIS);
          
@@ -124,7 +124,7 @@ Multi_measure_rest::brew_molecule (SCM smob)
   else 
     {
       String idx =  ("rests-") + to_str (-4);
-      s = me->get_default_font ()->find_by_name (idx);
+      s = Font_interface::get_default_font (me)->find_by_name (idx);
     }
   
   mol.add_molecule (s);
index 6930051b6a9c78b4e54e064eae818760fed1feb8..3bfe6ad551fd4a5db17be1456fc22df3f4861361 100644 (file)
@@ -10,7 +10,7 @@
 #include "dots.hh"
 #include "note-head.hh"
 #include "debug.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
 #include "molecule.hh"
 #include "musical-request.hh"
 
@@ -23,7 +23,7 @@ Molecule
 Note_head::ledger_line (Interval xwid, Score_element *me) 
 {
   Drul_array<Molecule> endings;
-  endings[LEFT] = me->get_default_font ()->find_by_name ("noteheads-ledgerending");
+  endings[LEFT] = Font_interface::get_default_font (me)->find_by_name ("noteheads-ledgerending");
   Molecule *e = &endings[LEFT];
   endings[RIGHT] = *e;
   
@@ -72,7 +72,7 @@ Note_head::brew_molecule (SCM smob)
     }
 
   // ugh: use gh_call ()
-  Molecule out = me->get_default_font ()->find_by_name (String ("noteheads-") + 
+  Molecule out = Font_interface::get_default_font (me)->find_by_name (String ("noteheads-") + 
                ly_scm2string (scm_eval2 (gh_list (ly_symbol2scm("find-notehead-symbol"),
                                                  me->get_elt_property ("duration-log"),
                                                  ly_quote_scm(style),
index ba703db23b712aa0957865eab2fc1ecc7f7f3e54..8332b128d1f6ce2d763f071835505e4967572d35 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <math.h>
 
+#include "all-font-metrics.hh"
 #include "string.hh"
 #include "misc.hh"
 #include "paper-def.hh"
@@ -21,6 +22,7 @@
 Paper_def::Paper_def ()
 {
   style_sheet_ = SCM_EOL;
+  scaled_fonts_ = SCM_EOL;
 }
 
 Paper_def::~Paper_def ()
@@ -30,6 +32,7 @@ Paper_def::~Paper_def ()
 Paper_def::Paper_def (Paper_def const&src)
   : Music_output_def (src)
 {
+  scaled_fonts_ = SCM_EOL;
   style_sheet_ = src.style_sheet_;
 }
 
@@ -56,9 +59,15 @@ Paper_def::get_realvar (SCM s) const
       return 0.0;
     }
 
+  Real sc = 1.0;
+  SCM ssc;
+  if (scope_p_->try_retrieve (ly_symbol2scm ("outputscale"), &ssc))
+    {
+      sc = gh_scm2double (ssc);
+    }
   if (gh_number_p (val))
     {
-      return gh_scm2double (val);
+      return gh_scm2double (val) / sc;
     }
   else
     {
@@ -127,4 +136,49 @@ Paper_def::base_output_str () const
   return str;
 }
 
+/*
+  todo: use symbols and hashtable idx?
+*/
+Font_metric *
+Paper_def::find_font (SCM fn, Real m)
+{
+  SCM key = gh_cons (fn, gh_double2scm (m));
+  SCM met = scm_assoc (key, scaled_fonts_);
+
+  if (gh_pair_p (met))
+    return unsmob_metrics (gh_cdr (met));
 
+  SCM ssc;
+  if (scope_p_->try_retrieve (ly_symbol2scm ("outputscale"), &ssc))
+    {
+      m /= gh_scm2double (ssc);
+    }
+  
+  Font_metric*  f = all_fonts_global_p->find_font (ly_scm2string (fn));
+  SCM val = Scaled_font_metric::make_scaled_font_metric (f, m);
+  scaled_fonts_ = scm_acons (key, val, scaled_fonts_ );
+
+  scm_unprotect_object (val);
+
+  return dynamic_cast<Scaled_font_metric*> (unsmob_metrics (val));
+}
+
+
+/*
+  Return alist to translate internally used fonts back to real-world
+  coordinates.  */
+SCM
+Paper_def::font_descriptions ()const
+{
+
+  
+  SCM l = SCM_EOL;
+  for (SCM s = scaled_fonts_; gh_pair_p (s); s = gh_cdr(s))
+    {
+      SCM desc = gh_caar (s);
+      SCM mdesc = unsmob_metrics (gh_cdar (s))->description_;
+
+      l = gh_cons (gh_cons (mdesc, desc), l);
+    }
+  return l;
+}
index 8ac3a8703607e0c53afda28994be1a2fab15fd7b..ec2cbab2c5e02947dda59cfec33a4372dcaefd6b 100644 (file)
@@ -200,16 +200,6 @@ Paper_outputter::output_version ()
 
 
 
-void
-Paper_outputter::output_font_def (int i, String str)
-{
-  SCM scm = gh_list (ly_symbol2scm ("font-def"),
-                    gh_int2scm (i),
-                    ly_str02scm (str.ch_l ()),
-                    SCM_UNDEFINED);
-
-  output_scheme (scm);
-}
 
 void
 Paper_outputter::output_Real_def (String k, Real v)
index 5e754287507b804595f1fa6cc195bb8d72e5abdb..2cc6685bf389591f86fc91d7e2734996b9b28122 100644 (file)
@@ -97,7 +97,7 @@ Paper_score::process ()
   outputter_l_ = new Paper_outputter (paper_l_->paper_stream_p ());
 ;
   outputter_l_->output_header ();
-  outputter_l_->output_version();
+  outputter_l_->output_version ();
   
   if (header_global_p)
     outputter_l_->output_scope (header_global_p, "mudela");
@@ -111,16 +111,15 @@ Paper_score::process ()
     outputter_l_->output_scope (paper_l_->scope_p_, "mudelapaper");
 
   SCM scm;
-  if(experimental_features_global_b)
+  if (experimental_features_global_b)
     {
       SCM scm = gh_list (ly_symbol2scm ("experimental-on"), SCM_UNDEFINED);
       outputter_l_->output_scheme (scm);
     }
   scm = gh_list (ly_symbol2scm ("header-end"), SCM_UNDEFINED);
   outputter_l_->output_scheme (scm);
-  
-  line_l_->output_lines ();
 
+  line_l_->output_lines ();
 
   scm = gh_list (ly_symbol2scm ("end-output"), SCM_UNDEFINED);
   outputter_l_->output_scheme (scm);
index 8990f345a3993f7d6a94772891bb1abc2730f815..fa21936f810bfa1e46b31253e46d7736a1ab5a22 100644 (file)
@@ -10,7 +10,6 @@
 #include "musical-request.hh"
 #include "score-element.hh"
 #include "item.hh"
-#include "font-metric.hh"
 #include "lily-guile.hh"
 #include "rhythmic-head.hh"
 #include "stem.hh"
index b6df666dfe025c2fce1a3bfdffdd3365b1059f74..da9caf8f4ade57368e139b0663b05c3d5f60aa6e 100644 (file)
@@ -8,7 +8,7 @@
 
 #include "molecule.hh"
 #include "paper-def.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
 #include "rest.hh"
 #include "dots.hh"
 #include "paper-score.hh"
@@ -64,7 +64,7 @@ Rest::brew_molecule (SCM smob)
   String idx =  ("rests-") + to_str (gh_scm2int (balltype))
     + (ledger_b ? "o" : "") + style;
 
-  return me-> get_default_font ()->find_by_name (idx).create_scheme();
+  return Font_interface::get_default_font (me)->find_by_name (idx).create_scheme();
 }
 
 
index 56861ca32fe989f4b32d2856731a57110efe375e..8c230f67162f6e1a3857577bd5747b62fcf12f29 100644 (file)
@@ -8,12 +8,7 @@
 
 #include "rhythmic-head.hh"
 #include "debug.hh"
-#include "molecule.hh"
-#include "paper-def.hh"
-#include "font-metric.hh"
 #include "rest.hh"
-#include "dots.hh"
-#include "paper-score.hh"
 #include "stem.hh"
 #include "staff-symbol-referencer.hh"
 #include "item.hh"
index 3327b2d8b639e157017a0dd6af8163cc35e1a4cf..27f8c34fc37deb852728888ee6d8ada6db0d91df 100644 (file)
@@ -6,6 +6,10 @@
 Scaled_font_metric::Scaled_font_metric (Font_metric* m, Real magn)
 {
   magnification_f_ = magn;
+  SCM desc = m->description_;
+
+  Real total_mag = magn * gh_scm2double (gh_cdr (desc));
+  description_ = gh_cons (gh_car (desc), gh_double2scm (total_mag));
   orig_l_ = m;
 }
 
@@ -13,23 +17,16 @@ SCM
 Scaled_font_metric::make_scaled_font_metric (Font_metric*m, Real s)
 {
   Scaled_font_metric *sfm = new Scaled_font_metric (m,s);
-  sfm->name_ = m->name_;
-  
   return sfm->self_scm ();
 }
 
-SCM
-Scaled_font_metric::description () const
-{
-  SCM od = orig_l_->description ();
-  // todo:
-  //  gh_set_cdr_x (od, gh_int2scm (magstep_i_));
-  return od;
-}
-
-
 Molecule
-Scaled_font_metric::find_by_name (String s, Real mag) const
+Scaled_font_metric::find_by_name (String s) const
 {
-  return orig_l_->find_by_name (s, magnification_f_ * mag);    // ugh.
+  Molecule m = orig_l_->find_by_name (s);
+  Box b = m.extent_box ();
+  b.scale (magnification_f_);
+  Molecule q(b,fontify_atom ((Font_metric*) this, m.get_expr ()));
+
+  return q ;
 }
index 2df18842ec05432450582e0f05c49b22a068b9e1..453b166e04bdbdcc6d06f84ccea7ab8e003d4963 100644 (file)
 #include <string.h>
 #include <math.h>
 
-#include "all-font-metrics.hh"
 #include "input-smob.hh"
 #include "libc-extension.hh"
 #include "group-interface.hh"
 #include "misc.hh"
 #include "paper-score.hh"
 #include "paper-def.hh"
-#include "font-metric.hh"
 #include "molecule.hh"
 #include "score-element.hh"
 #include "debug.hh"
@@ -875,32 +873,3 @@ Score_element::set_interface (SCM k)
 
 ADD_SCM_INIT_FUNC(scoreelt, init_functions);
 IMPLEMENT_TYPE_P(Score_element, "ly-element?");
-
-Font_metric *
-Score_element::get_default_font () const
-{
-  Font_metric * fm =  unsmob_metrics (get_elt_property ("font"));
-  if (fm)
-    return fm;
-
-  Score_element *me = (Score_element*)this;
-  SCM ss = me->paper_l ()->style_sheet_;
-
-  SCM proc = gh_cdr (scm_assoc (ly_symbol2scm ("properties-to-font"),
-                               ss));
-
-  SCM fonts = gh_cdr (scm_assoc (ly_symbol2scm ("fonts"), ss));
-  SCM defaults = gh_cdr (scm_assoc (ly_symbol2scm ("font-defaults"),
-                                   ss));
-
-  assert (gh_procedure_p (proc));
-  SCM font_name = gh_call2 (proc, fonts,
-                           gh_list (me->mutable_property_alist_,
-                                    me->immutable_property_alist_,
-                                    defaults,
-                                    SCM_UNDEFINED));
-
-  fm = find_font (ly_scm2string (font_name));
-  me->set_elt_property ("font", fm->self_scm ());
-  return fm;
-}
index 9f03377d5566ce934d72237d77a339da893fcb96..c49e37cd0c683e2b89b25cc943d08e167523311f 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "debug.hh"
 #include "script.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
 #include "side-position-interface.hh"
 #include "paper-def.hh"
 #include "item.hh"
@@ -25,12 +25,12 @@ Script::get_molecule(Score_element * me, Direction d)
   SCM key = gh_car  (s);
   if (key == ly_symbol2scm ("feta"))
     {
-      return me->get_default_font ()->find_by_name ("scripts-" +
+      return Font_interface::get_default_font (me)->find_by_name ("scripts-" +
                                    ly_scm2string (index_cell (gh_cdr (s), d)));
     }
   else if (key == ly_symbol2scm ("accordion"))
     {
-      return Lookup::accordion (gh_cdr (s), me->paper_l()->get_var("staffspace"), me->get_default_font ());
+      return Lookup::accordion (gh_cdr (s), me->paper_l()->get_var("staffspace"), Font_interface::get_default_font (me));
     }
   else
     assert (false);
index 6c9c628e997c2981b8055f938f4f8bcbf9bc70da..789a024ce1b2e42526dbe15db8357bd0131e1dcf 100644 (file)
@@ -104,7 +104,7 @@ Separating_group_spanner::add_spacing_unit (Score_element* me ,Item*i)
 
 
 void
-Separating_group_spanner::set_interface (Score_element*me)
+Separating_group_spanner::set_interface (Score_element*)
 {
 
 }
index 4c44b3c1b79eff47b8014657314b383ccaa720ed..07c7fd684393e07d846542637152f7957b5bedf4 100644 (file)
@@ -21,7 +21,6 @@
 #include "group-interface.hh"
 #include "slur.hh"
 #include "lookup.hh"
-#include "font-metric.hh"
 #include "paper-def.hh"
 #include "note-column.hh"
 #include "stem.hh"
index 4ffd7dbfdcdd9eff87d61755e6b93fcdc21fa36d..1da4c197af970de3f41251b5b015f935a4c3df89 100644 (file)
@@ -7,7 +7,7 @@
 */
 
 #include "span-bar.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
 #include "dimensions.hh"
 #include "paper-def.hh"
 #include "molecule.hh"
index 2a85ca2487c6320b88afda8f71739b3c628191ff..eaf2cb5a6f9c9f69f81a882610546141f6fd5537 100644 (file)
@@ -17,7 +17,7 @@
 #include "debug.hh"
 #include "paper-def.hh"
 #include "rhythmic-head.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
 #include "molecule.hh"
 #include "paper-column.hh"
 #include "misc.hh"
@@ -414,10 +414,10 @@ Stem::flag (Score_element*me)
     }
 
   char c = (get_direction (me) == UP) ? 'u' : 'd';
-  Molecule m = me->get_default_font ()->find_by_name (String ("flags-") + to_str (c) + 
+  Molecule m = Font_interface::get_default_font (me)->find_by_name (String ("flags-") + to_str (c) + 
                                      to_str (flag_i (me)));
   if (!style.empty_b ())
-    m.add_molecule(me->get_default_font ()->find_by_name (String ("flags-") + to_str (c) + style));
+    m.add_molecule(Font_interface::get_default_font (me)->find_by_name (String ("flags-") + to_str (c) + style));
   return m;
 }
 
index 2e931fb9bb2dff136b229845c7eeaf28161ba842..29df9ec87bc780224354ac6dfa2014bf1925b093 100644 (file)
@@ -8,7 +8,7 @@
  */
 #include "score-element.hh"
 #include "molecule.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
 #include "string.hh"
 
 // update comment --hwn 
@@ -56,7 +56,7 @@ Sustain_pedal::brew_molecule (SCM smob)
        }
       else
        idx += String (&text.byte_C ()[i], 1);
-      Molecule m = e->get_default_font ()->find_by_name (idx);
+      Molecule m = Font_interface::get_default_font (e)->find_by_name (idx);
       if (!m.empty_b ())
        mol.add_at_edge (X_AXIS, RIGHT, m, 0);
     }
index cc327778bfe796a7276f36ca4c1e0e31a2684ee9..5c345fb3e96e6e5af1b539faf4cf5107173b5c08 100644 (file)
@@ -12,7 +12,7 @@
 #include "system-start-delimiter.hh"
 #include "paper-def.hh"
 #include "molecule.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
 #include "all-font-metrics.hh"
 #include "score-element.hh"
 #include "lookup.hh"
@@ -123,8 +123,7 @@ System_start_delimiter::brew_molecule (SCM smob)
 Molecule
 System_start_delimiter::staff_brace (Score_element*me,Real y)  
 {
-  Real staffht  = me->paper_l ()->get_var ("staffheight");
-  int staff_size  = int (rint (staffht ));
+  int staff_size  = 20;                // URG.
 
   // URG
   Real step  = 1.0;
@@ -133,17 +132,10 @@ System_start_delimiter::staff_brace (Score_element*me,Real y)
   int idx = int (((maxht - step) <? y - minht) / step);
   idx = idx >? 0;
 
-  SCM l = scm_assoc (ly_str02scm ("brace"),
-                    scm_eval2 (ly_symbol2scm ("cmr-alist"), SCM_EOL));
+  Font_metric *fm = Font_interface::get_default_font (me);
   
-  String nm = "feta-braces";
-  if (l != SCM_BOOL_F)
-    nm = ly_scm2string (gh_cdr (l));
-  nm += to_str (staff_size);
-  SCM e =gh_list (ly_symbol2scm ("char"), gh_int2scm (idx), SCM_UNDEFINED);
-  SCM at = (e);
-
-  at = fontify_atom (find_font (nm), at);
+  SCM at =gh_list (ly_symbol2scm ("char"), gh_int2scm (idx), SCM_UNDEFINED);
+  at = fontify_atom (fm, at);
   
   Box b (Interval (0,0), Interval (-y/2, y/2));
 
index e1085702f950a8fc3e653eb43e2c9c4a2c9099a2..c26d5509c643d500ec510ec2f256aafce8f632e2 100644 (file)
@@ -11,7 +11,7 @@
 #include "debug.hh"
 #include "text-item.hh"
 #include "paper-def.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
 #include "staff-symbol-referencer.hh"
 #include "staff-symbol-referencer.hh"
 #include "main.hh"
@@ -105,19 +105,21 @@ Text_item::string2molecule (Score_element *me, SCM text, SCM alist_chain)
   SCM proc  = gh_cdr (scm_assoc (ly_symbol2scm ("properties-to-font"), sheet));
   SCM font_name = gh_call2 (proc, fonts, alist_chain);
 
-  SCM lookup = ly_assoc_chain (ly_symbol2scm ("lookup"), alist_chain);
+#if 0   
+  SCM lookup = scm_assoc (ly_symbol2scm ("lookup"), properties);
 
   Molecule mol;
   if (gh_pair_p (lookup) && ly_symbol2string (gh_cdr (lookup)) == "name")
     mol = lookup_character (me, font_name, text);
   else
-    mol = lookup_text (me, font_name, text);
+#endif
+  Molecule mol = lookup_text (me, font_name, text);
   
   return mol;
 }
 
 Molecule
-Text_item::lookup_character (Score_element *me, SCM font_name, SCM char_name)
+Text_item::lookup_character (Score_element *, SCM font_name, SCM char_name)
 {
   Adobe_font_metric *afm = all_fonts_global_p->find_afm (ly_scm2string (font_name));
   
@@ -140,11 +142,14 @@ Text_item::lookup_text (Score_element *me, SCM font_name, SCM text)
   Font_metric* metric = 0;
   if (gh_number_p (magnification))
     {
+#if 0
       Real realmag = pow (1.2, gh_scm2int (magnification));
       metric = all_fonts_global_p->find_scaled (ly_scm2string (font_name), realmag);
+#endif
+      assert (false);
     }
   else
-    metric = all_fonts_global_p->find_font (ly_scm2string (font_name));
+    metric = me->paper_l ()->find_font (font_name, 1.0);
   
   SCM list = gh_list (ly_symbol2scm ("text"), text, SCM_UNDEFINED);
   list = fontify_atom (metric, list);
@@ -156,26 +161,32 @@ Molecule
 Text_item::markup_sentence2molecule (Score_element *me, SCM markup_sentence,
                                     SCM alist_chain)
 {
+  /*
+    FIXME
+   */
+  return Molecule ();
+  
   SCM sheet = me->paper_l ()->style_sheet_;
-  SCM f = gh_cdr (scm_assoc (ly_symbol2scm ("markup-to-properties"), sheet));
+  SCM f = gh_cdr (scm_assoc (ly_symbol2scm ("markup-abbrev-to-properties-alist"), sheet));
+  
   SCM markup = gh_car (markup_sentence);
   SCM sentence = gh_cdr (markup_sentence);
   
-  SCM p = gh_cons  (gh_call2 (f, sheet, markup), alist_chain);
+  SCM p = gh_cons  (gh_call1 (f, markup), alist_chain);
 
   Axis align = X_AXIS;
-  SCM a = ly_assoc_chain (ly_symbol2scm ("align"), p);
+  SCM a = scm_assoc (ly_symbol2scm ("align"), p);
   if (gh_pair_p (a) && gh_number_p (gh_cdr (a)))
     align = (Axis)gh_scm2int (gh_cdr (a));
 
   Real staff_space = Staff_symbol_referencer::staff_space (me);
   Real kern = 0;
-  SCM k = ly_assoc_chain (ly_symbol2scm ("kern"), p);
+  SCM k = scm_assoc (ly_symbol2scm ("kern"), p);
   if (gh_pair_p (k) && gh_number_p (gh_cdr (k)))
     kern = gh_scm2double (gh_cdr (k)) * staff_space;
                             
   Real raise = 0;
-  SCM r = ly_assoc_chain (ly_symbol2scm ("raise"), p);
+  SCM r = scm_assoc (ly_symbol2scm ("raise"), p);
   if (gh_pair_p (r) && gh_number_p (gh_cdr (r)))
     raise = gh_scm2double (gh_cdr (r)) * staff_space;
 
index 42267504b4981877d1a6458f7aa723bc1172eea9..c74400fe79ae79dce57c713c65992f827705a5b4 100644 (file)
@@ -10,7 +10,7 @@
 #include "text-item.hh"
 #include "text-spanner.hh"
 #include "spanner.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
 #include "dimensions.hh"
 #include "paper-def.hh"
 #include "debug.hh"
index cdfb8535dde2153b7b29b56af8bf4fe95f36b9d6..2ce125cdbe49a8b689e0688d714837871738735e 100644 (file)
@@ -74,10 +74,9 @@ Tex_font_metric::find_ascii (int ascii, bool warn) const
 }
 
 Box
-Tex_font_metric::get_char (int a, Real mag) const
+Tex_font_metric::get_char (int a) const
 {
   Box b = find_ascii (a)->dimensions () ;
-  b.scale (mag);
   return b;
 }
 
@@ -98,7 +97,7 @@ Tex_font_metric::str () const
 SCM
 Tex_font_metric::make_tfm (String fn)
 {
-  Tex_font_metric      * tfm_p = new Tex_font_metric;
+  Tex_font_metric * tfm_p = new Tex_font_metric;
   Tex_font_metric_reader reader (fn);
 
   tfm_p->info_ = reader.info_;
index 035071ba45cd980bbc9dd6b95ed717dca24fcb9c..4e3f7e2057bdcfd321d688a4d3819429617fe5e5 100644 (file)
@@ -12,7 +12,7 @@
 #include "text-item.hh"
 #include "time-signature.hh"
 #include "paper-def.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
 
 MAKE_SCHEME_CALLBACK(Time_signature,brew_molecule,1);
 
@@ -53,12 +53,12 @@ Time_signature::special_time_signature (Score_element*me, String s, int n, int d
   // First guess: s contains only the signature style
   String symbolname = "timesig-" + s + to_str (n) + "/" + to_str (d);
   
-  Molecule m = me->get_default_font ()->find_by_name (symbolname);
+  Molecule m = Font_interface::get_default_font (me)->find_by_name (symbolname);
   if (!m.empty_b()) 
     return m;
 
   // Second guess: s contains the full signature name
-  m = me->get_default_font ()->find_by_name ("timesig-"+s);
+  m = Font_interface::get_default_font (me)->find_by_name ("timesig-"+s);
   if (!m.empty_b ()) 
     return m;
 
@@ -71,6 +71,7 @@ Molecule
 Time_signature::time_signature (Score_element*me,int num, int den)
 {
   SCM chain = gh_list (me->mutable_property_alist_, me->immutable_property_alist_, SCM_UNDEFINED);
+
   Molecule n = Text_item::text2molecule (me,
                                         ly_str02scm (to_str (num).ch_C ()),
                                         chain);
index cf4bba50f51f8e319a5967df84f216e99461d1d8..739a179bc24544b07ce67ae22c683ec87920583d 100644 (file)
@@ -10,7 +10,7 @@
 #include "beam.hh"
 #include "box.hh"
 #include "debug.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
 #include "molecule.hh"
 #include "paper-column.hh"
 #include "paper-def.hh"
index bb6b6236ad86a4be040bff5535e5049bfbbd3ee9..7dde58677cd6f159b0a9316eddcec59e839a7bb7 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "box.hh"
 #include "debug.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
 #include "molecule.hh"
 #include "paper-column.hh"
 #include "paper-def.hh"
 void
 Volta_spanner::set_interface (Score_element*me)
 {
-  Side_position::set_axis (me, Y_AXIS);
-  Directional_element_interface::set (me, UP);
 }
 
-
 /*
   this is too complicated. Yet another version of side-positioning,
   badly implemented.
@@ -36,7 +33,6 @@ Volta_spanner::set_interface (Score_element*me)
 
   * Should look for system_start_delim to find left edge of staff.
   
-  
 */
 
 MAKE_SCHEME_CALLBACK(Volta_spanner,brew_molecule,1);
index bda61747a1758ec5021672d3caefdc7fd86496fa..553e81041ee3ba326c06abdc8d41767589a79e9c 100644 (file)
@@ -9,6 +9,7 @@ paperfile = \papersize + ".ly";
 
 staffspace = \staffheight / 4.0;
 stafflinethickness = \staffspace / 10.0;
+outputscale = \staffheight / 4.0;
 
 \translator { \NoteNamesContext }
 \translator { \ScoreContext }
index 2993adac9a884265fa924ac08f3c0ea598f03068..d8fdac84c6d719c4364365def3391a6fabc28bcd 100644 (file)
@@ -1,15 +1,15 @@
 Begin3
 Title: LilyPond
-Version: 1.3.99
-Entered-date: 25OCT00
+Version: 1.3.100
+Entered-date: 30OCT00
 Description: 
 Keywords: music notation typesetting midi fonts engraving
 Author: hanwen@cs.uu.nl (Han-Wen Nienhuys)
        janneke@gnu.org (Jan Nieuwenhuizen)
 Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys)
 Primary-site: sunsite.unc.edu /pub/Linux/apps/sound/convert
-       1000k lilypond-1.3.99.tar.gz 
+       1000k lilypond-1.3.100.tar.gz 
 Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/
-       1000k lilypond-1.3.99.tar.gz 
+       1000k lilypond-1.3.100.tar.gz 
 Copying-policy: GPL
 End
index 920db01e65b91a6fd946dfb73f3940dc3037bb64..fed023f61c67d6731780b7eba1576aa3ddaa3a17 100644 (file)
@@ -1,9 +1,9 @@
 Name: lilypond
-Version: 1.3.99
+Version: 1.3.100
 Release: 1
 License: GPL
 Group: Applications/Publishing
-Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.99.tar.gz
+Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.100.tar.gz
 Summary: A program for printing sheet music.
 URL: http://www.cs.uu.nl/~hanwen/lilypond
 # Icon: lilypond-icon.gif
diff --git a/mf/feta-din12.mf b/mf/feta-din12.mf
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/mf/feta-din14.mf b/mf/feta-din14.mf
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/mf/feta-din3.mf b/mf/feta-din3.mf
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/mf/feta-din6.mf b/mf/feta-din6.mf
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/mf/feta-nummer12.mf b/mf/feta-nummer12.mf
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/mf/feta-nummer14.mf b/mf/feta-nummer14.mf
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/mf/feta-nummer3.mf b/mf/feta-nummer3.mf
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/mf/feta-nummer6.mf b/mf/feta-nummer6.mf
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/scm/ascii-script.scm b/scm/ascii-script.scm
new file mode 100644 (file)
index 0000000..ea9bc54
--- /dev/null
@@ -0,0 +1,190 @@
+
+;;;; AsciiScript as
+(define (as-scm action-name)
+
+  (define (beam width slope thick)
+         (string-append
+          (func "set-line-char" "#")
+          (func "rline-to" width (* width slope))
+          ))
+
+  ; simple flat slurs
+  (define (bezier-sandwich l thick)
+         (let (
+               (c0 (cadddr l))
+               (c1 (cadr l))
+               (c3 (caddr l)))
+              (let* ((x (car c0))
+                     (dx (- (car c3) x))
+                     (dy (- (cdr c3) (cdr c0)))
+                     (rc (/ dy dx))
+                     (c1-dx (- (car c1) x))
+                     (c1-line-y (+ (cdr c0) (* c1-dx rc)))
+                     (dir (if (< c1-line-y (cdr c1)) 1 -1))
+                     (y (+ -1 (* dir (max (* dir (cdr c0)) (* dir (cdr c3)))))))
+                    (string-append
+                     (func "rmove-to" x y)
+                     (func "put" (if (< 0 dir) "/" "\\\\"))
+                     (func "rmove-to" 1 (if (< 0 dir) 1 0))
+                     (func "set-line-char" "_")
+                     (func "h-line" (- dx 1))
+                     (func "rmove-to" (- dx 1) (if (< 0 dir) -1 0))
+                     (func "put" (if (< 0 dir) "\\\\" "/"))))))
+
+  (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
+         (string-append
+          (func "rmove-to" (+ width 1) (- (/ height -2) 1))
+          (func "put" "\\\\")
+          (func "set-line-char" "|")
+          (func "rmove-to" 0 1)
+          (func "v-line" (+ height 1))
+          (func "rmove-to" 0 (+ height 1))
+          (func "put" "/")
+          ))
+
+  (define (char i)
+    (func "char" i))
+
+  (define (define-origin a b c ) "")
+
+  (define (end-output) 
+    (func "end-output"))
+  
+  (define (experimental-on)
+         "")
+
+  (define (filledbox breapth width depth height)
+         (let ((dx (+ width breapth))
+               (dy (+ depth height)))
+              (string-append 
+               (func "rmove-to" (* -1 breapth) (* -1 depth))
+               (if (< dx dy)
+                   (string-append
+                    (func "set-line-char" 
+                          (if (<= dx 1) "|" "#"))
+                    (func "v-line" dy))
+                   (string-append
+                    (func "set-line-char" 
+                          (if (<= dy 1) "-" "="))
+                   (func "h-line" dx))))))
+
+  (define (font-load-command name-mag command)
+    (func "load-font" (car name-mag) (magstep (cdr name-mag))))
+
+  (define (header creator generate) 
+    (func "header" creator generate))
+
+  (define (header-end) 
+    (func "header-end"))
+
+  ;; urg: this is good for half of as2text's execution time
+  (define (xlily-def key val)
+         (string-append "(define " key " " (arg->string val) ")\n"))
+
+  (define (lily-def key val)
+         (if 
+          (or (equal? key "mudelapaperlinewidth")
+              (equal? key "mudelapaperstaffheight"))
+          (string-append "(define " key " " (arg->string val) ")\n")
+          ""))
+
+  (define (no-origin) "")
+  
+  (define (placebox x y s) 
+    (let ((ey (inexact->exact y)))
+         (string-append "(move-to " (number->string (inexact->exact x)) " "
+                        (if (= 0.5 (- (abs y) (abs ey)))
+                            (number->string y)
+                            (number->string ey))
+                        ")\n" s)))
+                      
+  (define (select-font name-mag-pair)
+    (let* ((c (assoc name-mag-pair font-name-alist)))
+      (if (eq? c #f)
+         (begin
+           (ly-warn 
+            (string-append 
+             "Programming error: No such font known " 
+             (car name-mag-pair))))
+           "")                         ; issue no command
+         (func "select-font" (car font-name-symbol)))))
+
+  (define (start-line height)
+         (func "start-line" height))
+
+  (define (stop-line)
+         (func "stop-line"))
+
+  (define (text s)
+         (func "text" s))
+
+  (define (tuplet ht gap dx dy thick dir) "")
+
+  (define (volta h w thick vert-start vert-end)
+         ;; urg
+         (string-append
+          (func "set-line-char" "|")
+          (func "rmove-to" 0 -4)
+          ;; definition strange-way around
+          (if (= 0 vert-start)
+             (func "v-line" h)
+              "")
+          (func "rmove-to" 1 h)
+          (func "set-line-char" "_")
+          (func "h-line" (- w 1))
+          (func "set-line-char" "|")
+          (if (= 0 vert-end)
+              (string-append
+               (func "rmove-to" (- w 1) (* -1 h))
+               (func "v-line" (* -1 h)))
+              "")))
+
+  (cond ((eq? action-name 'all-definitions)
+        `(begin
+           (define beam ,beam)
+           (define bracket ,bracket)
+           (define char ,char)
+           (define define-origin ,define-origin)
+           ;;(define crescendo ,crescendo)
+           (define bezier-sandwich ,bezier-sandwich)
+           ;;(define dashed-slur ,dashed-slur) 
+           ;;(define decrescendo ,decrescendo) 
+           (define end-output ,end-output)
+           (define experimental-on ,experimental-on)
+           (define filledbox ,filledbox)
+           ;;(define font-def ,font-def)
+           (define font-load-command ,font-load-command)
+           ;;(define font-switch ,font-switch)
+           (define header ,header) 
+           (define header-end ,header-end)
+           (define lily-def ,lily-def)
+           ;;(define invoke-char ,invoke-char) 
+           ;;(define invoke-dim1 ,invoke-dim1)
+           (define no-origin ,no-origin)
+           (define placebox ,placebox)
+           (define select-font ,select-font)
+           (define start-line ,start-line)
+           ;;(define stem ,stem)
+           (define stop-line ,stop-line)
+           (define stop-last-line ,stop-line)
+           (define text ,text)
+           (define tuplet ,tuplet)
+           (define volta ,volta)
+           ))
+       ((eq? action-name 'tuplet) tuplet)
+       ;;((eq? action-name 'beam) beam)
+       ;;((eq? action-name 'bezier-sandwich) bezier-sandwich)
+       ;;((eq? action-name 'bracket) bracket)
+       ((eq? action-name 'char) char)
+       ;;((eq? action-name 'crescendo) crescendo)
+       ;;((eq? action-name 'dashed-slur) dashed-slur) 
+       ;;((eq? action-name 'decrescendo) decrescendo)
+       ;;((eq? action-name 'experimental-on) experimental-on)
+       ((eq? action-name 'filledbox) filledbox)
+       ((eq? action-name 'select-font) select-font)
+       ;;((eq? action-name 'volta) volta)
+       (else (error "unknown tag -- MUSA-SCM " action-name))
+       )
+  )
+
+
index e6ab9134188f7df9c76601a7410a38e08c035800..86781547158210fa18d20c0366d00aa7590c3c38 100644 (file)
@@ -38,7 +38,9 @@
                (visibility-lambda . ,begin-of-line-visible)
                (padding . 1.0)
                (direction . 1)
+                (markup-to-properties . ,markup-to-properties)
                 (font-family . roman)
+               
                (font-relative-size . -1)
                (meta . ,(element-description "BarNumber"
                        text-interface  font-interface break-aligned-interface))
@@ -89,8 +91,8 @@
                (molecule-callback . ,Chord_name::brew_molecule)
                (after-line-breaking-callback . ,Chord_name::after_line_breaking)
                (chord-name-function . ,default-chord-name-function)
-               (font-family . roman)
-               (meta . ,(element-description "ChordNames"  font-interface text-interface chord-name-interface))
+               (markup-to-properties . ,markup-to-properties)
+               (meta . ,(element-description "ChordNames"  font-interface chord-name-interface))
        ))
 
        (NoteCollision . (
                (Y-offset-callbacks . (,Side_position::aligned_on_self))
                (molecule-callback . ,Text_item::brew_molecule)
                (script-priority . 100)
-               (font-series . bold)
-               (font-family . dynamic)
+               (font-style . dynamic)
+                (markup-to-properties . ,markup-to-properties)
                (self-alignment-Y . 0)
                (meta . ,(element-description "DynamicText" font-interface  text-interface ))
        ))
                (X-offset-callbacks . (,Side_position::centered_on_parent ,Side_position::aligned_on_self))
                (padding .      3.0)
                (self-alignment-X . 0)
-               (font-family . number)
-               (font-relative-size . -3)
+               
+               (font-style . finger)
+                (markup-to-properties . ,markup-to-properties)
                (meta . ,(element-description "Fingering" finger-interface  font-interface text-script-interface text-interface side-position-interface))
        ))
 
                (molecule-callback . ,Text_item::brew_molecule)         
                (break-align-symbol . Instrument_name)
                (visibility-lambda . ,begin-of-line-visible)
+               (markup-to-properties . ,markup-to-properties)
                (font-family . roman)
                (meta . ,(element-description "InstrumentName"  font-interface  text-interface break-aligned-interface))
        ))
                (self-alignment-X . 0)
                (non-rhythmic . #t)
                (word-space . 0.6)
+               
+               (markup-to-properties . ,markup-to-properties)
                (font-family . roman)
                (font-shape . upright)
                (font-relative-size . 0)
+                
                (meta . ,(element-description "LyricText" lyric-syllable-interface text-interface font-interface ))
        ))
        
        (RehearsalMark . (
-               (molecule-callback . ,Text_item::brew_molecule) 
-               (breakable . #t)
-               (font-family . number)
-               (font-relative-size . 1)
-               (visibility-lambda . ,end-of-line-invisible)
-               (padding . 4.0)
-               (meta . ,(element-description "RehearsalMark"  mark-interface side-position-interface))
+         (molecule-callback . ,Text_item::brew_molecule)       
+         (breakable . #t)
+              (markup-to-properties . ,markup-to-properties)
+               (font-style . mark)
+                (visibility-lambda . ,end-of-line-invisible)
+         (padding . 4.0)
+         (meta . ,(element-description "RehearsalMark"  mark-interface side-position-interface))
        ))
        
        (MultiMeasureRest . (
                (expand-limit . 10)
                (padding . 2.0) ; staffspace
                (minimum-width . 12.5) ; staffspace
-               (font-family . number)
-               (font-relative-size . 1)
+               (markup-to-properties . ,markup-to-properties)
+               (font-style . mmrest)
                (meta . ,(element-description "MultiMeasureRest" multi-measure-rest-interface  font-interface ))
        ))
        
        (NoteName . (
                (style . default)
                (molecule-callback . ,Text_item::brew_molecule)
+                (markup-to-properties . ,markup-to-properties)
                (meta . ,(element-description  "NoteName"
                                               note-name-interface font-interface
                                               general-element-interface))
                (Y-offset-callbacks . (,Side_position::aligned_side))
                (molecule-callback . ,Text_item::brew_molecule)
                 (font-shape . italic)
+                (markup-to-properties . ,markup-to-properties)
+
                (meta . ,(element-description "OctavateEight" text-interface font-interface ))
        ))
        
                (molecule-callback . ,Text_item::brew_molecule)         
                (break-align-symbol . Clef_item)
                (visibility-lambda . ,begin-of-line-visible)
+                (markup-to-properties . ,markup-to-properties)
                (font-family . roman)
-               (meta . ,(element-description "StanzaNumber" break-aligned-interface text-interface font-interface))
+(meta . ,(element-description "StanzaNumber" break-aligned-interface text-interface font-interface))
        ))
 
        (StaffSymbol . (
                  ,Side_position::centered_on_parent))
                (no-spacing-rods . #t)
                 (font-shape . italic)
+                (markup-to-properties . ,markup-to-properties)
+               
                (self-alignment-X . 0)
                (meta . ,(element-description "SostenutoPedal" text-interface  font-interface))
        ))
                (self-alignment-X . 0)
                (X-offset-callbacks . (,Side_position::aligned_on_self))
                (Y-offset-callbacks .
-                                   (,Side_position::aligned_side
-                                    ,Side_position::centered_on_parent))
+                (,Side_position::aligned_side
+                 ,Side_position::centered_on_parent))
 
                (meta . ,(element-description "SustainPedal" sustain-pedal-interface side-position-interface font-interface))
        ))
                (arch-width . 1.5)
                (bracket-thick . 0.25)
                (bracket-width . 2.0)
+               (font-family . braces)
+               (font-point-size . 20)
                (Y-extent-callback . #f)
-               (meta . ,(element-description "SystemStartDelimiter" system-start-delimiter ))
+               (meta . ,(element-description "SystemStartDelimiter" system-start-delimiter font-interface))
        ))
 
        (TextScript . (
                (molecule-callback . ,Text_item::brew_molecule)
                (no-spacing-rods . #t)
                (padding . 0.5)
-               (font-family . roman)
-               (font-shape . italic)
-               (font-relative-size . 0)
+               (markup-to-properties . ,markup-to-properties)
+               (font-family . roman)
+               (font-shape . italic)
+               (font-relative-size . 0)
                (meta . ,(element-description "TextScript" text-script-interface text-interface side-position-interface font-interface ))
        ))
        (TextSpanner . (
                (molecule-callback . ,Text_spanner::brew_molecule)
                 (font-shape . italic)
+                (markup-to-properties . ,markup-to-properties)
                (type . "line")
                (direction . 1)
                (meta . ,(element-description "TextSpanner" text-spanner-interface  font-interface))            
        ))
 
        (TimeSignature . (
-                (molecule-callback . ,Time_signature::brew_molecule)
+               (molecule-callback . ,Time_signature::brew_molecule)
                (break-align-symbol . Time_signature)
                (visibility-lambda . ,all-visible)
                (breakable . #t)
-                (font-family . number)
-                (font-relative-size . 0)
-                (meta . ,(element-description "TimeSignature" time-signature-interface  font-interface))
+                (markup-to-properties . ,markup-to-properties)
+                (font-style . timesig)
+               (meta . ,(element-description "TimeSignature" time-signature-interface  font-interface))
        ))
 
        (TupletBracket . (
                (thick . 1.0)
                (after-line-breaking-callback . ,Tuplet_spanner::after_line_breaking)
                (molecule-callback . ,Tuplet_spanner::brew_molecule)
-               (font-shape . italic)
-               (font-relative-size . -1)
+                (markup-to-properties . ,markup-to-properties)
+                (font-style . tuplet)
                (meta .  ,(element-description "TupletBracket" text-interface
                           tuplet-bracket-interface font-interface))
        ))
        (UnaChordaPedal . (
                (molecule-callback . ,Text_item::brew_molecule)
                 (font-shape . italic)
+                (markup-to-properties . ,markup-to-properties)
                (no-spacing-rods . #t)
                (self-alignment-X . 0)
                (X-offset-callbacks . (,Side_position::aligned_on_self))
 
        (VoltaBracket . (
                (molecule-callback . ,Volta_spanner::brew_molecule)
+       
                (direction . 1)
-               (padding . 5)
-               (font-family . number)
-               (font-relative-size . -2)
+               (padding . 1)
+                (markup-to-properties . ,markup-to-properties)
+                (font-style . volta)
+               (Y-offset-callbacks . (,Side_position::aligned_side))
                (thickness . 1.6)  ;  stafflinethickness
                (height . 2.0) ; staffspace;
                (minimum-space . 25)
index d41741cb6118c6e76d4521144bdb0e6c236290ca..deebd5e4c26035145a7e0a251c90c4bff36d259e 100644 (file)
@@ -19,7 +19,8 @@
        ((eq? name 'font-shape) 2)
        ((eq? name 'font-family) 3)
        ((eq? name 'font-name) 4)
-       ((eq? name 'font-point-size-size) 5)
+       ((eq? name 'font-point-size) 5)
+       (else (ly-warning "unknown font field name"))
        )
        ))
   
        (dynamic . ((font-series . bold) (font-family . dynamic) (font-relative-size . 0)))
        ))
     (properties-to-font . ,properties-to-font-name)
-    (markup-to-properties . ,markup-to-properties)
-    (abbreviation-alist
-     .
-     ((rows . ((align . 0)))
+
+    ;; FIXME: this is a not-so-cool idea to use ALIGN
+    ;; RAISE, LOOKUP, since they are not proper elt-properties,
+    ;; and might interfere with them.
+    (markup-abbrev-to-properties-alist
+     . ((rows . ((align . 0)))
        (lines . ((align . 1)))
        (roman . ((font-family . roman)))
-       (music . ((font-family . music) (font-shape . upright) (font-series . medium)))
+       (music . ((font-family . music)))
        (finger . ((font-style . finger)))
        (bold . ((font-series . bold)))
        (italic . ((font-shape . italic)))
     )
   )
 
+
+
+(define (font-regexp-to-font-name paper regexp)
+  (let ((style-sheet (cdr (assoc paper style-sheet-alist))))
+    (let loop ((fonts style-sheet))
+      (if (string-match regexp (caar fonts))
+         (cdar fonts)
+         (if (pair? (cdr fonts))
+             (loop (cdr fonts))
+             '())))))
+
 ;; reduce the font list by successively applying a font-qualifier.
 (define (qualifiers-to-fontnames  qualifiers font-descr-alist)
   (if (null? qualifiers)
        selected)       ; return the topmost.
     ))
 
-(define (markup-to-properties sheet markup)
+(define markup-abbrev-to-properties-alist
+  (append
+    (map (lambda (x) (cons (car x) (cons 'font-style (car x))))
+       style-to-font-alist)))
+
+(define (markup-to-properties markup)
   ;;(display "markup: `")
-  ;;(write markup)
+  ;;(display markup)
   ;;(display "'\n")
   (if (pair? markup)
       (list markup)
-      (let ((entry (assoc markup
-                         ;; assoc-chain?
-                         (append (cdr (assoc 'abbreviation-alist sheet))
-                                 (cdr (assoc 'style-alist sheet))))))
-       (if entry
-           (cdr entry)
+      (let ((entry (assoc markup markup-abbrev-to-properties-alist)))
+       (if entry (cdr entry)
            (list (cons markup #t))))))
 
 ; fixme, how's this supposed to work?
index 4e34b96bd5425546260165887acce83949d7bf84..a2834f250ec0ec2bc415daf3b4c3358f7a4b6b4e 100644 (file)
@@ -4,13 +4,11 @@
 ; 
 ; (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
 
-
 ;
 ; This file contains various routines in Scheme that are easier to 
 ; do here than in C++.  At present it is an unorganised mess. Sorry. 
 ;
 
-
 ; We should repartition the entire scm side of lily in a
 ; more sane way, using namesspaces/modules?
 
 (define (number-pair?  x)
   (and (pair? x) (number? (car x)) (number? (cdr x))))
 
+(define (object-type obj)
+  (cond
+   ((dir? obj) "direction")
+   ((number-pair? obj) "pair of numbers")
+   ((ly-input-location? obj) "input location")   
+   ((ly-element? obj) "graphic element")
+   ((pair? obj) "pair")
+   ((integer? obj) "integer")
+   ((list? obj) "list")
+   ((symbol? obj) "symbol")
+   ((string? obj) "string")
+   ((boolean? obj) "boolean")
+   ((moment? obj) "moment")
+   ((number? obj) "number")
+   ((char? obj) "char")
+   ((input-port? obj) "input port")
+   ((output-port? obj) "output port")   
+   ((vector? obj) "vector")
+   ((procedure? obj) "procedure") 
+   (else "unknown type")
+  ))
+
+
 (define (type-name  predicate)
   (cond
    ((eq? predicate dir?) "direction")
                   (if (< duration 0) "mensural" "")))
    ((default) (number->string duration))
    (else
-    (string-append (number->string duration) (symbol->string style)))))
+    (string-append (number->string duration) (symbol->string style))))
+  )
 
 
 ;;;;;;;; TeX
 
-;; this is silly, can't we use something like
-;; roman-0, roman-1 roman+1 ?
-(define cmr-alist 
-  '(("bold" . "cmbx") 
-    ("brace" . "feta-braces")
-    ("default" . "cmr10")
-    ("dynamic" . "feta-din") 
-    ("feta" . "feta") 
-    ("feta-1" . "feta") 
-    ("feta-2" . "feta") 
-    ("typewriter" . "cmtt") 
-    ("italic" . "cmti") 
-    ("msam" . "msam") 
-    ("roman" . "cmr") 
-    ("script" . "cmr") 
-    ("large" . "cmbx") 
-    ("Large" . "cmbx") 
-    ("mark" . "feta-nummer") 
-    ("finger" . "feta-nummer")
-    ("timesig" . "feta-nummer")
-    ("number" . "feta-nummer") 
-    ("volta" . "feta-nummer"))
-)
-
 (define (string-encode-integer i)
   (cond
    ((= i  0) "o")
    (else (string-append
          (make-string 1 (integer->char (+ 65 (modulo i 26))))
          (string-encode-integer (quotient i 26))
-        )
+         ))
    )
   )
-  )
 
-(define (magstep i)
-  (cdr (assoc i '((-4 . 482)
-                 (-3 . 579)
-                 (-2 . 694)
-                 (-1 . 833)
-                 (0 . 1000)
-                 (1 . 1200) 
-                 (2 . 1440)
-                 (3 . 1728)
-                 (4 . 2074))
-             )
-       )
-  )
-            
 (define default-script-alist '())
 
 (define font-name-alist  '())
-(define (font-command name-mag)
-    (cons name-mag
-         (string-append  "magfont"
-                         (string-encode-integer (hashq (car name-mag) 1000000))
+(define (tex-encoded-fontswitch name-mag)
+  (let* (
+        (iname-mag (car name-mag))
+        (ename-mag (cdr name-mag))
+        )
+    (cons iname-mag
+         (cons ename-mag
+               (string-append  "magfont"
+                         (string-encode-integer
+                          (hashq (car ename-mag) 1000000))
                          "m"
-                         (string-encode-integer (cdr name-mag)))
+                         (string-encode-integer
+                          (inexact->exact (* 1000 (cdr ename-mag))))
 
-         )
-    )
-(define (define-fonts names)
-  (set! font-name-alist (map font-command names))
+                         )
+               )
+    )))
+
+(define (define-fonts internal-external-name-mag-pairs)
+  (set! font-name-alist (map tex-encoded-fontswitch
+                            internal-external-name-mag-pairs))
   (apply string-append
         (map (lambda (x)
-               (font-load-command (car x) (cdr x))) font-name-alist)
-  ))
+               (font-load-command (car x) (cdr x)))
+             (map cdr font-name-alist)  
 
-(define (fontify name exp)
-  (string-append (select-font name)
+  )))
+
+(define (fontify name-mag-pair exp)
+  (string-append (select-font name-mag-pair)
                 exp)
   )
 
     "%\n\\unknown%\n")
 
 
-  (define (select-font font-name-symbol)
+  (define (select-font name-mag-pair)
     (let*
        (
-        (c (assoc font-name-symbol font-name-alist))
+        (c (assoc name-mag-pair font-name-alist))
         )
 
       (if (eq? c #f)
          (begin
+           (display "FAILED\n")
+           (display (object-type (car name-mag-pair)))
+           (display (object-type (caaar font-name-alist)))
+
            (ly-warn (string-append
-                     "Programming error: No such font known " (car font-name-symbol)))
-           "")                         ; issue no command
-         (string-append "\\" (cdr c)))
+                     "Programming error: No such font known "
+                     (car name-mag-pair) " "
+                     (number->string (cdr name-mag-pair))
+                     ))
+           "") ; issue no command
+         (string-append "\\" (cddr c)))
       
       
       ))
   (define (font-load-command name-mag command)
     (string-append
      "\\font\\" command "="
-     (symbol->string (car name-mag))
+     (car name-mag)
      " scaled "
-     (number->string (magstep (cdr name-mag)))
+     (number->string (inexact->exact (* 1000  (cdr name-mag))))
      "\n"))
 
   (define (embedded-ps s)
                                   (ly-gulp-file "lily.ps") 'pre " %\n" 'post)
         (ly-gulp-file "lily.ps"))
      "}"
-     "\\input lilyponddefs \\turnOnPostScript"))
+     "\\input lilyponddefs\\newdimen\\outputscale \\outputscale=\\mudelapaperoutputscale pt\\turnOnPostScript"))
 
   (define (header creator generate) 
     (string-append
 
   (define (number->dim x)
     (string-append 
-     (ly-number->string x) " pt "))
+     (ly-number->string x) " \\outputscale "))
 
   (define (placebox x y s) 
     (string-append 
      "lilyfont"
      (make-string 1 (integer->char (+ 65 i)))))
     
-  (define (mag-to-size m)
-    (number->string (case m 
-                     (0 12)
-                     (1 12)
-                     (2 14) ; really: 14.400
-                     (3 17) ; really: 17.280
-                     (4 21) ; really: 20.736
-                     (5 24) ; really: 24.888
-                     (6 30) ; really: 29.856
-                     )))
-  
-  
-  (define (select-font font-name-symbol)
+
+  (define (select-font name-mag-pair)
     (let*
        (
-        (c (assoc font-name-symbol font-name-alist))
+        (c (assoc name-mag-pair font-name-alist))
         )
 
       (if (eq? c #f)
          (begin
+           (display name-mag-pair)
+           (display font-name-alist)
            (ly-warn (string-append
-                     "Programming error: No such font known " (car font-name-symbol)))
-           "")                         ; issue no command
+                     "Programming error: No such font known " (car name-mag-pair))
+                    (number->string (cdr name-mag-pair))
+                    )
+           
+           "")                         ; issue no command        
          (string-append " " (cdr c) " "))
-      
-      
       ))
 
     (define (font-load-command name-mag command)
        " { /"
        (symbol->string (car name-mag))
        " findfont "
-       (number->string (magstep (cdr name-mag)))
+       (number->string (cdr name-mag))
        " 1000 div 12 mul  scalefont setfont } bind def "
        "\n"))
 
        ((string? arg) (string-append "\"" arg "\""))
        ((symbol? arg) (string-append "\"" (symbol->string arg) "\""))))
 
+; ugh: naming.
 (define (func name . args)
   (string-append 
    "(" name 
       1
       (if (< x 0) -1 1)))
 
-;;;; AsciiScript as
-(define (as-scm action-name)
-
-  (define (beam width slope thick)
-         (string-append
-          (func "set-line-char" "#")
-          (func "rline-to" width (* width slope))
-          ))
-
-  ; simple flat slurs
-  (define (bezier-sandwich l thick)
-         (let (
-               (c0 (cadddr l))
-               (c1 (cadr l))
-               (c3 (caddr l)))
-              (let* ((x (car c0))
-                     (dx (- (car c3) x))
-                     (dy (- (cdr c3) (cdr c0)))
-                     (rc (/ dy dx))
-                     (c1-dx (- (car c1) x))
-                     (c1-line-y (+ (cdr c0) (* c1-dx rc)))
-                     (dir (if (< c1-line-y (cdr c1)) 1 -1))
-                     (y (+ -1 (* dir (max (* dir (cdr c0)) (* dir (cdr c3)))))))
-                    (string-append
-                     (func "rmove-to" x y)
-                     (func "put" (if (< 0 dir) "/" "\\\\"))
-                     (func "rmove-to" 1 (if (< 0 dir) 1 0))
-                     (func "set-line-char" "_")
-                     (func "h-line" (- dx 1))
-                     (func "rmove-to" (- dx 1) (if (< 0 dir) -1 0))
-                     (func "put" (if (< 0 dir) "\\\\" "/"))))))
-
-  (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
-         (string-append
-          (func "rmove-to" (+ width 1) (- (/ height -2) 1))
-          (func "put" "\\\\")
-          (func "set-line-char" "|")
-          (func "rmove-to" 0 1)
-          (func "v-line" (+ height 1))
-          (func "rmove-to" 0 (+ height 1))
-          (func "put" "/")
-          ))
-
-  (define (char i)
-    (func "char" i))
-
-  (define (define-origin a b c ) "")
-
-  (define (end-output) 
-    (func "end-output"))
-  
-  (define (experimental-on)
-         "")
-
-  (define (filledbox breapth width depth height)
-         (let ((dx (+ width breapth))
-               (dy (+ depth height)))
-              (string-append 
-               (func "rmove-to" (* -1 breapth) (* -1 depth))
-               (if (< dx dy)
-                   (string-append
-                    (func "set-line-char" 
-                          (if (<= dx 1) "|" "#"))
-                    (func "v-line" dy))
-                   (string-append
-                    (func "set-line-char" 
-                          (if (<= dy 1) "-" "="))
-                   (func "h-line" dx))))))
-
-  (define (font-load-command name-mag command)
-    (func "load-font" (car name-mag) (magstep (cdr name-mag))))
-
-  (define (header creator generate) 
-    (func "header" creator generate))
-
-  (define (header-end) 
-    (func "header-end"))
-
-  ;; urg: this is good for half of as2text's execution time
-  (define (xlily-def key val)
-         (string-append "(define " key " " (arg->string val) ")\n"))
-
-  (define (lily-def key val)
-         (if 
-          (or (equal? key "mudelapaperlinewidth")
-              (equal? key "mudelapaperstaffheight"))
-          (string-append "(define " key " " (arg->string val) ")\n")
-          ""))
-
-  (define (no-origin) "")
-  
-  (define (placebox x y s) 
-    (let ((ey (inexact->exact y)))
-         (string-append "(move-to " (number->string (inexact->exact x)) " "
-                        (if (= 0.5 (- (abs y) (abs ey)))
-                            (number->string y)
-                            (number->string ey))
-                        ")\n" s)))
-                      
-  (define (select-font font-name-symbol)
-    (let* ((c (assoc font-name-symbol font-name-alist)))
-      (if (eq? c #f)
-         (begin
-           (ly-warn 
-            (string-append 
-             "Programming error: No such font known " 
-             (car font-name-symbol)))
-           "")                         ; issue no command
-         (func "select-font" (car font-name-symbol)))))
-
-  (define (start-line height)
-         (func "start-line" height))
-
-  (define (stop-line)
-         (func "stop-line"))
-
-  (define (text s)
-         (func "text" s))
-
-  (define (tuplet ht gap dx dy thick dir) "")
-
-  (define (volta h w thick vert-start vert-end)
-         ;; urg
-         (string-append
-          (func "set-line-char" "|")
-          (func "rmove-to" 0 -4)
-          ;; definition strange-way around
-          (if (= 0 vert-start)
-             (func "v-line" h)
-              "")
-          (func "rmove-to" 1 h)
-          (func "set-line-char" "_")
-          (func "h-line" (- w 1))
-          (func "set-line-char" "|")
-          (if (= 0 vert-end)
-              (string-append
-               (func "rmove-to" (- w 1) (* -1 h))
-               (func "v-line" (* -1 h)))
-              "")))
-
-  (cond ((eq? action-name 'all-definitions)
-        `(begin
-           (define beam ,beam)
-           (define bracket ,bracket)
-           (define char ,char)
-           (define define-origin ,define-origin)
-           ;;(define crescendo ,crescendo)
-           (define bezier-sandwich ,bezier-sandwich)
-           ;;(define dashed-slur ,dashed-slur) 
-           ;;(define decrescendo ,decrescendo) 
-           (define end-output ,end-output)
-           (define experimental-on ,experimental-on)
-           (define filledbox ,filledbox)
-           ;;(define font-def ,font-def)
-           (define font-load-command ,font-load-command)
-           ;;(define font-switch ,font-switch)
-           (define header ,header) 
-           (define header-end ,header-end)
-           (define lily-def ,lily-def)
-           ;;(define invoke-char ,invoke-char) 
-           ;;(define invoke-dim1 ,invoke-dim1)
-           (define no-origin ,no-origin)
-           (define placebox ,placebox)
-           (define select-font ,select-font)
-           (define start-line ,start-line)
-           ;;(define stem ,stem)
-           (define stop-line ,stop-line)
-           (define stop-last-line ,stop-line)
-           (define text ,text)
-           (define tuplet ,tuplet)
-           (define volta ,volta)
-           ))
-       ((eq? action-name 'tuplet) tuplet)
-       ;;((eq? action-name 'beam) beam)
-       ;;((eq? action-name 'bezier-sandwich) bezier-sandwich)
-       ;;((eq? action-name 'bracket) bracket)
-       ((eq? action-name 'char) char)
-       ;;((eq? action-name 'crescendo) crescendo)
-       ;;((eq? action-name 'dashed-slur) dashed-slur) 
-       ;;((eq? action-name 'decrescendo) decrescendo)
-       ;;((eq? action-name 'experimental-on) experimental-on)
-       ((eq? action-name 'filledbox) filledbox)
-       ((eq? action-name 'select-font) select-font)
-       ;;((eq? action-name 'volta) volta)
-       (else (error "unknown tag -- MUSA-SCM " action-name))
-       )
-  )
-
-
 (define (gulp-file name)
   (let* ((port (open-file name "r"))
         (content (let loop ((text ""))
index 8a9b50fb9f203cb189f00b37e2525526a694a050..dc08ba9395177ddd6eb721bf428d7ecff70a129e 100644 (file)
@@ -28,9 +28,8 @@
 
 # Enhancements (Laura Conrad)
 #
-# Barring now preserved between ABC and lilypond
-# the default placement for text in abc is above the staff.
-                       
+# Beaming now preserved between ABC and lilypond
+#
 # Limitations
 #
 # Multiple tunes in single file not supported
@@ -76,7 +75,6 @@ lyric_idx = -1
 part_names = 0
 default_len = 8
 length_specified = 0
-nobarlines = 0
 global_key = [0] * 7                   # UGH
 names = ["One", "Two", "Three"]
 DIGITS='0123456789'
@@ -95,10 +93,6 @@ def check_clef(s):
               else:
                       state.base_octave = 0
                       voices_append("\\clef treble;\n")
-      elif re.match('^-8va', s):
-             s = s[4:]
-             state.base_octave = -1
-             voices_append("\\clef \"G_8\";\n")
       elif re.match('^alto', s):
               s = s[4:]
               state.base_octave = -1
@@ -213,7 +207,6 @@ def dump_score (outf):
 
 
 def set_default_length (s):
-       global length_specified
        m =  re.search ('1/([0-9]+)', s)
        if m:
                __main__.default_len = string.atoi ( m.group (1))
@@ -496,7 +489,6 @@ def slyrics_append(a):
 
 
 def try_parse_header_line (ln, state):
-       global length_specified
        m = re.match ('^([A-Za-z]): *(.*)$', ln)
 
        if m:
@@ -513,18 +505,15 @@ def try_parse_header_line (ln, state):
                        if a == 'C':
                                if not state.common_time:
                                        state.common_time = 1
-#                                      voices_append ("\\property Staff.timeSignatureStyle=\"C\"\n")
-                                       voices_append ("\\property Staff.TimeSignature \push #\'style = #\"C\"\n")
+                                       voices_append ("\\property Staff.timeSignatureStyle=\"C\"\n")
                                a = '4/4'
                        if a == 'C|':
                                if not state.common_time:
                                        state.common_time = 1
-                                       voices_append ("\\property Staff.TimeSignature \push #\'style = #\"C\"\n")
+                                       voices_append ("\\property Staff.timeSignatureStyle=\"C\"\n")
                                a = '2/2'
                        if not length_specified:
                                set_default_len_from_time_sig (a)
-                       else:
-                               length_specified = 0
                        voices_append ('\\time %s;' % a)
                        state.next_bar = ''
                if g == 'K': # KEY
@@ -532,19 +521,11 @@ def try_parse_header_line (ln, state):
                        if a:
                                m = re.match ('^([^ \t]*) *(.*)$', a) # seperate clef info
                                if m:
-                                       # there may or may not be a space
-                                       # between the key letter and the mode
-                                       if key_lookup.has_key(m.group(2)[0:3]):
-                                               key_info = m.group(1) + m.group(2)[0:3]
-                                               clef_info = m.group(2)[4:]
-                                       else:
-                                               key_info = m.group(1)
-                                               clef_info = m.group(2)
-                                       __main__.global_key  = compute_key (key_info)# ugh.
-                                       voices_append ('\\key %s;' % lily_key(key_info))
-                                       check_clef(clef_info)
+                                       __main__.global_key  =compute_key (m.group(1))# ugh.
+                                       voices_append ('\\key %s;' % lily_key(m.group(1)))
+                                       check_clef(m.group(2))
                                else:
-                                       __main__.global_key  = compute_key (a)# ugh.
+                                       __main__.global_key  =compute_key (a)# ugh.
                                        voices_append ('\\key %s \\major;' % lily_key(a))
                if g == 'O': # Origin
                        header ['origin'] = a
@@ -586,8 +567,7 @@ def try_parse_header_line (ln, state):
 def pitch_to_mudela_name (name, acc, bar_acc, key):
        s = ''
        if acc == UNDEF:
-               if not nobarlines:
-                       acc = bar_acc
+               acc = bar_acc
        if acc == UNDEF:
                acc = key
        if acc == -1:
@@ -886,7 +866,7 @@ def try_parse_guitar_chord (str, state):
                if str:
                        str = str[1:]
                gc = re.sub('#', '\\#', gc)     # escape '#'s
-               state.next_articulation = ("^\"%s\"" % gc) + state.next_articulation
+               state.next_articulation = ("-\"%s\"" % gc) + state.next_articulation
        return str
 
 def try_parse_escape (str):
@@ -913,7 +893,7 @@ bar_dict = {
 '[|' : '||',
 ':|' : ':|',
 '|:' : '|:',
-'::' : ':|:',
+'::' : '::',
 '|1' : '|',
 '|2' : '|',
 ':|2' : ':|',
@@ -1017,23 +997,6 @@ def try_parse_grace_delims (str, state):
 
        return str
 
-def try_parse_comment (str):
-       global nobarlines
-       #debugging
-#      sys.stderr.write("str: %s \n" % str)
-
-       # for now, just do %%MIDI nobarlines
-       if (str[0] == '%'):
-               #debugging
-#              sys.stderr.write("we have %%\n")
-               if str[0:5] == '%MIDI':
-                       #debugging
-#                      sys.stderr.write ("we have %%MIDI\n")
-                       if (string.find(str,'nobarlines') > 0):
-                               #debugging
-#                              sys.stderr.write ("we have nobarlines\n")
-                               nobarlines = 1
-       return str
 
 happy_count = 100
 def parse_file (fn):
@@ -1055,7 +1018,6 @@ def parse_file (fn):
                m = re.match  ('^([^%]*)%(.*)$',ln)  # add comments to current voice
                if m:
                        if m.group(2):
-                               try_parse_comment(m.group(2))
                                voices_append ('%% %s\n' % m.group(2))
                        ln = m.group (1)
 
index ca33b2543d22e8077507c934cf27e84531741c5e..45a0db23e16d3a4dd5a39a2fe76bfdb8a318016b 100644 (file)
@@ -7,12 +7,13 @@
 % header info (macros/defs, etc) should go into a \special{! ... }, 
 % note the ! sign.  See dvips.info for details.
 %
-
+\def\lilySpace{ }
 \def\turnOnPostScript{%
         % This sets CTM so that you get to the currentpoint
         % by executing a 0 0 moveto
         \def\embeddedps##1{%
-                \special{ps: @beginspecial @setspecial ##1 @endspecial}       
+                \special{ps: @beginspecial @setspecial
+        \mudelapaperoutputscale\lilySpace\mudelapaperoutputscale\lilySpace scale ##1 @endspecial}%
         }
 }