]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.3.99.jcn2
authorJan Nieuwenhuizen <janneke@gnu.org>
Sat, 28 Oct 2000 13:44:16 +0000 (15:44 +0200)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sat, 28 Oct 2000 13:44:16 +0000 (15:44 +0200)
1.3.99.jcn2
===========

* Font initialisation and markup translation fixes.

1.3.99.hwn2
===========

* tweaks of .scm font-selection.

* Rewrote font management of Score_element and Paper_def.

---
Generated by janneke@gnu.org,
From = lilypond-1.3.99.jcn1, To = lilypond-1.3.99.jcn2

usage

    cd lilypond-source-dir; patch -E -p1 < lilypond-1.3.99.jcn2.diff

Patches do not contain automatically generated files
or (urg) empty directories,
i.e., you should rerun autoconf, configure

71 files changed:
CHANGES
VERSION
lily/afm.cc
lily/all-font-metrics.cc
lily/arpeggio.cc
lily/bar.cc
lily/beam.cc
lily/box.cc
lily/break-algorithm.cc
lily/breathing-sign.cc
lily/chord-name-engraver.cc
lily/chord-name.cc
lily/clef-item.cc
lily/crescendo.cc
lily/dots.cc
lily/font-metric.cc
lily/grace-align-item.cc
lily/hyphen-spanner.cc
lily/include/afm.hh
lily/include/all-font-metrics.hh
lily/include/box.hh
lily/include/font-metric.hh
lily/include/lookup.hh
lily/include/paper-def.hh
lily/include/score-element.hh
lily/include/slur-bezier-bow.hh
lily/include/tfm.hh
lily/key-item.cc
lily/local-key-item.cc
lily/lookup.cc
lily/lyric-engraver.cc
lily/lyric-extender.cc
lily/multi-measure-rest.cc
lily/my-lily-lexer.cc
lily/note-head.cc
lily/paper-def.cc
lily/paper-outputter.cc
lily/paper-score.cc
lily/parser.yy
lily/piano-pedal-engraver.cc
lily/rest.cc
lily/rhythmic-head.cc
lily/scaled-font-metric.cc [new file with mode: 0644]
lily/scm-hash.cc
lily/score-element.cc
lily/script.cc
lily/slur-bezier-bow.cc
lily/slur.cc
lily/span-bar.cc
lily/staff-symbol.cc
lily/stem-tremolo.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/tie.cc
lily/time-signature.cc
lily/tuplet-spanner.cc
lily/volta-spanner.cc
ly/paper11.ly
ly/paper13.ly
ly/paper16.ly
ly/paper20.ly
ly/paper23.ly
ly/paper26.ly
ly/params.ly
scm/element-descriptions.scm
scm/font.scm
scm/interface.scm

diff --git a/CHANGES b/CHANGES
index 835d1196caf5efa6c5afb1aa5e9767abda491286..9f8dc8ce2cd7ccdc47335fd0e6a94a35a7f9160b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,22 @@
---- ../lilypond-1.3.99/CHANGES Wed Oct 25 07:03:07 2000
+--- ../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. 
+
+* Rewrote font management of Score_element and Paper_def.
+
+
+ 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
diff --git a/VERSION b/VERSION
index 1616b490ab5d3db973c6d91c6d897ac1b2e57638..e55659135e7d01fea368096912c7f441a00f657c 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=3
 PATCH_LEVEL=99
-MY_PATCH_LEVEL=lec1
+MY_PATCH_LEVEL=jcn2
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
index c86c1faafcd4980ee24f7492826dbc2841d14c79..7fcca1bd6a072c96c6a8ae81267282fdf4bb6f6f 100644 (file)
@@ -8,6 +8,7 @@
  */
 #include "afm.hh"
 #include "warn.hh"
+#include "molecule.hh"
 
 Adobe_font_metric::Adobe_font_metric (AFM_Font_info * fi)
 {
@@ -31,7 +32,7 @@ Adobe_font_metric::make_afm (AFM_Font_info *fi)
 {
   Adobe_font_metric * fm = new Adobe_font_metric (fi);
 
-  return fm->smobbed_self();    
+  return fm->self_scm();    
 }
 
 
@@ -73,14 +74,16 @@ Adobe_font_metric::find_char_metric (String nm, bool warn) const
 
 
 Box
-Adobe_font_metric::get_char (int code, bool warn) const
+Adobe_font_metric::get_char (int code, Real mag) const
 {
   AFM_CharMetricInfo const
-    * c =  find_ascii_metric (code,warn);
+    * c =  find_ascii_metric (code,false);
+  Box b (Interval (0,0),Interval(0,0));
   if (c)
-    return afm_bbox_to_box (c->charBBox);                      
-  else
-    return Box (Interval (0,0),Interval(0,0));
+    b = afm_bbox_to_box (c->charBBox);                 
+
+  b.scale (mag);
+  return b;
 }
 
 SCM
@@ -93,7 +96,7 @@ read_afm_file (String nm)
 
   if (ok)
     {
-      error (_("Error parsing AFM file"));
+      error (_f ("Error parsing AFM file: %s", nm.ch_C ()));
       exit (2);
     }
   fclose (f);
@@ -115,3 +118,25 @@ Adobe_font_metric::~Adobe_font_metric ()
 {
   AFM_free (font_inf_);
 }
+
+Molecule
+Adobe_font_metric::find_by_name (String s, Real mag) const
+{
+  AFM_CharMetricInfo const *cm = find_char_metric (s, false);
+
+  if (!cm)
+    {
+      Molecule m;
+      m.set_empty (false);
+      return m;
+    }
+  
+  SCM at =  (gh_list (ly_symbol2scm ("char"),
+                     gh_int2scm (cm->code),
+                     SCM_UNDEFINED));
+  
+  at= fontify_atom ((Font_metric*)this, at);
+  Box b = afm_bbox_to_box (cm->charBBox);
+  b.scale (mag);
+  return Molecule (b, at);
+}
index ab4d17759ca92e9a28006b771eda3a7e0f018eb5..795664edf4136f20779d72849611e1ad97a1bbc5 100644 (file)
@@ -75,14 +75,14 @@ All_font_metrics::find_afm (String name)
 
       afm_p_dict_->set (sname,val);
 
-      
+      scm_unprotect_object (val);      
     }
   
   return dynamic_cast<Adobe_font_metric*> (unsmob_metrics (val));
 }
 
 Scaled_font_metric * 
-All_font_metrics::find_scaled (String nm, int m)
+All_font_metrics::find_scaled (String nm, Real m)
 {
   String index =  nm + "@" + to_str (m);
   SCM sname = ly_symbol2scm (index.ch_C ());
@@ -94,8 +94,9 @@ All_font_metrics::find_scaled (String nm, int m)
       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));
 }
@@ -130,6 +131,8 @@ All_font_metrics::find_tfm (String name)
 
       unsmob_metrics (val)->name_ = sname;
       tfm_p_dict_->set (sname, val);
+
+      scm_unprotect_object (val);
     }
     
   return
@@ -202,5 +205,5 @@ All_font_metrics::font_descriptions () const
 Font_metric*
 find_font (String name)
 {
-  return   all_fonts_global_p->find_font (name);
+  return all_fonts_global_p->find_font (name);
 }
index 68226226ab9aff93bb23194a029a2aef2c11b01f..aebc96b8306edc5fbbe28ed4f7549bc44e49af9d 100644 (file)
@@ -8,7 +8,7 @@
 
 #include "molecule.hh"
 #include "paper-def.hh"
-#include "lookup.hh"
+#include "font-metric.hh"
 #include "arpeggio.hh"
 #include "score-element.hh"
 #include "stem.hh"
@@ -68,7 +68,7 @@ Arpeggio::brew_molecule (SCM smob)
     }
   
   Molecule mol;
-  Molecule arpeggio = me->paper_l ()->lookup_l (0)->afm_find ("scripts-arpeggio");
+  Molecule arpeggio = me->get_default_font ()->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->paper_l ()->lookup_l (0)->afm_find ("scripts-arpeggio");
+  Molecule arpeggio = me->get_default_font ()->find_by_name ("scripts-arpeggio");
 
   return ly_interval2scm (arpeggio.extent (X_AXIS) * 1.5);
 }
index 4192fd0780b254741076798413283792eb10dab7..3305fd945fab23b784036a100ff1bbb8bc0ca8bd 100644 (file)
@@ -7,15 +7,15 @@
 */
 #include <math.h>
 
+#include "lookup.hh"
 #include "paper-column.hh"
 #include "main.hh"
-#include "dimensions.hh"
 #include "score-element.hh"
 #include "bar.hh"
 #include "string.hh"
 #include "molecule.hh"
 #include "paper-def.hh"
-#include "lookup.hh"
+#include "font-metric.hh"
 #include "debug.hh"
 #include "all-font-metrics.hh"
 #include "item.hh"
@@ -61,13 +61,13 @@ 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->lookup_l ()->afm_find ("dots-repeatcolon");  
+  Molecule colon = me->get_default_font ()->find_by_name ("dots-repeatcolon");  
 
   Molecule m;
   
   if (str == "")
     {
-      return me->lookup_l ()->blank (Box (Interval(0, 0), Interval (-h/2, h/2)));
+      return Lookup::blank (Box (Interval(0, 0), Interval (-h/2, h/2)));
     }
   else if (str == "|")
     {
@@ -118,9 +118,9 @@ Bar::compound_barline (Score_element*me, String str, Real h)
 
 
 Molecule
-Bar::simple_barline (Score_element*me,Real w, Real h) 
+Bar::simple_barline (Score_element*,Real w, Real h) 
 {
-  return me->lookup_l ()->filledbox (Box (Interval(0,w), Interval(-h/2, h/2)));
+  return Lookup::filledbox (Box (Interval(0,w), Interval(-h/2, h/2)));
 }
 
 MAKE_SCHEME_CALLBACK(Bar,before_line_breaking ,1);
index c4013abfcf5b02505fbebd1b7ced280b79040e0b..9bbb4f794c00b507ec297e925f10889d6be0c8ad 100644 (file)
@@ -20,7 +20,7 @@
 
 #include <math.h> // tanh.
 
-
+#include "molecule.hh" 
 #include "directional-element-interface.hh"
 #include "beaming.hh"
 #include "beam.hh"
@@ -699,7 +699,7 @@ Beam::stem_beams (Score_element*me,Item *here, Item *next, Item *prev)
       w = w/2 <? nw_f;
       Molecule a;
       if (lhalfs)              // generates warnings if not
-       a =  me->lookup_l ()->beam (dydx, w, thick);
+       a =  Lookup::beam (dydx, w, thick);
       a.translate (Offset (-w, -w * dydx));
       for (int j = 0; j  < lhalfs; j++)
        {
@@ -715,7 +715,7 @@ Beam::stem_beams (Score_element*me,Item *here, Item *next, Item *prev)
       int rwholebeams= Stem::beam_count (here,RIGHT) <? Stem::beam_count (next,LEFT) ;
 
       Real w = next->relative_coordinate (0, X_AXIS) - here->relative_coordinate (0, X_AXIS);
-      Molecule a = me->lookup_l ()->beam (dydx, w + stemdx, thick);
+      Molecule a = Lookup::beam (dydx, w + stemdx, thick);
       a.translate_axis( - stemdx/2, X_AXIS);
       int j = 0;
       Real gap_f = 0;
@@ -735,7 +735,7 @@ Beam::stem_beams (Score_element*me,Item *here, Item *next, Item *prev)
          // TODO: notehead widths differ for different types
          gap_f = nw_f / 2;
          w -= 2 * gap_f;
-         a = me->lookup_l ()->beam (dydx, w + stemdx, thick);
+         a = Lookup::beam (dydx, w + stemdx, thick);
        }
 
       for (; j  < rwholebeams; j++)
@@ -747,7 +747,7 @@ Beam::stem_beams (Score_element*me,Item *here, Item *next, Item *prev)
 
       w = w/2 <? nw_f;
       if (rhalfs)
-       a = me->lookup_l ()->beam (dydx, w, thick);
+       a = Lookup::beam (dydx, w, thick);
 
       for (; j  < rwholebeams + rhalfs; j++)
        {
index 722e08278cbc2351a0a0171183bc0c846faafe6b..6f8bf3439496eadd80957e6f92615494fa2a8752 100644 (file)
@@ -54,3 +54,10 @@ Box::operator[] (Axis a)const
 {
   return interval_a_[a];
 }
+
+void
+Box::scale (Real s)
+{
+  interval_a_[X_AXIS] *= s;
+  interval_a_[Y_AXIS] *= s;
+}
index 5bf45d838450967da7633df0bc461fd6b91e9756..14ff931c98b53a8ec775e754af58f60ac176b278 100644 (file)
@@ -59,7 +59,7 @@ Simple_spacer*
 Break_algorithm::generate_spacing_problem (Link_array<Score_element> curline, Interval line) const
 {
   Simple_spacer * sp =  new Simple_spacer;
-  Paper_def * d = pscore_l_->paper_l_;
+
   /*
     this is hardcoded, but this shouldn't happen anyway.
     used to be g et_var ("loose_column_distance");        
index 6f245f9920d5a7eb6cacb33dd70c58cd4e3c96ce..a00d8c4712d0abbd6b7033752f80429df4b85d31 100644 (file)
@@ -31,12 +31,12 @@ Breathing_sign::brew_molecule (SCM smob)
   Interval i1(0, space / 6), i2(-space / 2, space / 2);
   Box b(i1, i2);
 
-  return me->lookup_l()->filledbox(b).create_scheme ();
+  return Lookup::filledbox(b).create_scheme ();
 }
 
 MAKE_SCHEME_CALLBACK(Breathing_sign,offset_callback,2);
 SCM
-Breathing_sign::offset_callback (SCM element_smob, SCM axis)
+Breathing_sign::offset_callback (SCM element_smob, SCM )
 {
   Score_element *me = unsmob_element (element_smob);
   
index 9a0944e2ee072ae843566989f8e80afa55409a11..b49f03bce86008cf6264f1506ce4d36caf25d402 100644 (file)
@@ -11,7 +11,7 @@
 #include "chord.hh"
 #include "musical-request.hh"
 #include "paper-def.hh"
-#include "lookup.hh"
+#include "font-metric.hh"
 #include "paper-def.hh"
 #include "main.hh"
 #include "dimensions.hh"
index 523de92f6be654189802e349ac5b6742e96407a8..7f42c254078fea83918ff31f478f439252a87413 100644 (file)
@@ -9,7 +9,7 @@
 #include "chord-name.hh"
 #include "molecule.hh"
 #include "paper-def.hh"
-#include "lookup.hh"
+#include "font-metric.hh"
 #include "score-element.hh"
 #include "paper-column.hh"
 #include "line-of-score.hh"
@@ -60,8 +60,7 @@ Chord_name::brew_molecule (SCM smob)
   SCM func = me->get_elt_property (ly_symbol2scm ("chord-name-function"));
   SCM text = gh_call3 (func, style, pitches, gh_cons (inversion, bass));
 
-  SCM properties = gh_append2 (me->immutable_property_alist_,
-                              me->mutable_property_alist_);
+  SCM properties = gh_list (me->mutable_property_alist_, me->immutable_property_alist_, SCM_UNDEFINED);
   Molecule mol = Text_item::text2molecule (me, text, properties);
 
   SCM space =  me->get_elt_property ("word-space");
index 44d716424eeca1ede25a824cd988489d7011fd1f..4985ac69b9d1aede03e358f5f088cc979b722368 100644 (file)
@@ -11,7 +11,7 @@
 #include "string.hh"
 #include "molecule.hh"
 #include "item.hh"
-#include "lookup.hh"
+#include "font-metric.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->lookup_l ()->afm_find (String (ly_scm2string (glyph))).create_scheme ();
+      return sc->get_default_font ()->find_by_name (String (ly_scm2string (glyph))).create_scheme ();
     }
   else
     {
index 3e021dbc02cf00c54cbb1b7836eb1a0713af40aa..2f7535f6f8c094dc271771e16f158fe8b86e9bee 100644 (file)
@@ -9,7 +9,7 @@
 #include "molecule.hh"
 #include "crescendo.hh"
 #include "spanner.hh"
-#include "lookup.hh"
+#include "font-metric.hh"
 #include "dimensions.hh"
 #include "paper-def.hh"
 #include "debug.hh"
index db1fc24b2e65dd208ed8fba4a792f34fb9e27c33..4e9dc5659a85050cdc5266d16057ab83fc7e4c53 100644 (file)
@@ -10,6 +10,7 @@
 #include "item.hh"
 #include "molecule.hh"
 #include "paper-def.hh"
+#include "font-metric.hh"
 #include "lookup.hh"
 #include "staff-symbol-referencer.hh"
 #include "directional-element-interface.hh"
@@ -42,22 +43,25 @@ SCM
 Dots::brew_molecule (SCM d)
 {
   Score_element *sc = unsmob_element (d);
-  Molecule mol (sc->lookup_l ()->blank (Box (Interval (0,0),
-                                        Interval (0,0))));
+  /*
+    Molecule mol (Lookup::blank (Box (Interval (0,0),
+                                   Interval (0,0))));
+  */
 
+  Molecule mol;
+  
   SCM c = sc->get_elt_property ("dot-count");
+
   if (gh_number_p (c))
     {
-      Molecule d = sc->lookup_l ()->afm_find (String ("dots-dot"));
-
+      Molecule d = sc->get_default_font ()->find_by_name (String ("dots-dot"));
       Real dw = d.extent (X_AXIS).length ();
-      d.translate_axis (-dw, X_AXIS);
-
+      //      d.translate_axis (-dw, X_AXIS);
 
       for (int i = gh_scm2int (c); i--; )
        {
          d.translate_axis (2*dw,X_AXIS);
-         mol.add_molecule (d);
+         mol.add_at_edge (X_AXIS, RIGHT, d, dw);
        }
     }
   return mol.create_scheme ();
index 467f0f84cfdb15cfa8d70957131847fc03751c1b..08a27382ce9eb1934a5069f327f0a46d60aba669 100644 (file)
 #include <math.h>
 #include <ctype.h>
 
+#include "molecule.hh"
 #include "ly-smobs.icc"
 #include "font-metric.hh"
 #include "string.hh"
 
 Box
-Font_metric::text_dimension (String text) const
+Font_metric::text_dimension (String text, Real mag) const
 {
   Interval ydims;
   Real w=0.0;
@@ -38,11 +39,11 @@ Font_metric::text_dimension (String text) const
          break;
        
        default: 
-         Box b = get_char ((unsigned char)text[i],false);
+         Box b = get_char ((unsigned char)text[i],mag);
          
          // Ugh, use the width of 'x' for unknown characters
          if (b[X_AXIS].length () == 0) 
-           b = get_char ((unsigned char)'x',false);
+           b = get_char ((unsigned char)'x',mag);
          
          w += b[X_AXIS].length ();
          ydims.unite (b[Y_AXIS]);
@@ -57,12 +58,12 @@ Font_metric::text_dimension (String text) const
 
 
 Box
-Scaled_font_metric::text_dimension (String t) const
+Scaled_font_metric::text_dimension (String t,Real mag) const
 {
-  Real realmag = pow (1.2, magstep_i_);
   Box b (orig_l_->text_dimension (t));
 
-  return Box(b[X_AXIS]* realmag, b[Y_AXIS]*realmag);
+  b.scale (magnification_f_ * mag);
+  return b;
 }
 
 Font_metric::~Font_metric ()
@@ -72,6 +73,8 @@ Font_metric::~Font_metric ()
 Font_metric::Font_metric ()
 {
   name_ = SCM_EOL;
+
+  smobify_self ();
 }
 
 Font_metric::Font_metric (Font_metric const &)
@@ -80,26 +83,11 @@ Font_metric::Font_metric (Font_metric const &)
 
 
 Box 
-Font_metric::get_char (int, bool)const
+Font_metric::get_char (int, Real )const
 {
   return Box (Interval(0,0),Interval (0,0));
 }
 
-Scaled_font_metric::Scaled_font_metric (Font_metric* m, int s)
-{
-  magstep_i_ = s;
-  orig_l_ = m;
-}
-
-SCM
-Scaled_font_metric::make_scaled_font_metric (Font_metric*m, int s)
-{
-  Scaled_font_metric *sfm = new Scaled_font_metric (m,s);
-  sfm->name_ = m->name_;
-  
-  return sfm->smobbed_self ();
-}
-
 SCM
 Font_metric::description () const
 {
@@ -107,16 +95,6 @@ Font_metric::description () const
 }
 
 
-SCM
-Scaled_font_metric::description () const
-{
-  SCM od = orig_l_->description ();
-  gh_set_cdr_x (od, gh_int2scm (magstep_i_));
-  return od;
-}
-
-
-
 SCM
 Font_metric::mark_smob (SCM s)
 {
@@ -136,5 +114,12 @@ Font_metric::print_smob (SCM s, SCM port, scm_print_state * )
 
 
 IMPLEMENT_UNSMOB (Font_metric, metrics);
-IMPLEMENT_SIMPLE_SMOBS (Font_metric);
+IMPLEMENT_SMOBS (Font_metric);
 IMPLEMENT_DEFAULT_EQUAL_P(Font_metric);
+IMPLEMENT_TYPE_P (Font_metric, "font-metric?");
+
+Molecule
+Font_metric::find_by_name (String, Real mag ) const
+{
+  assert (false);
+}
index f18b7d03550642ed79b697ca728585c1106d0889..8d9cbf9ddca477ae3f20df7a90c77f7856f62d62 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "grace-align-item.hh"
 #include "align-interface.hh"
-#include "lookup.hh"
+#include "font-metric.hh"
 #include "paper-column.hh"
 #include "paper-def.hh"
 
index 3ff71c7743420fd640854ae71088d5ba313731a8..a45a246a88327588270c90ce44ab09cb8ea71812 100644 (file)
@@ -40,8 +40,6 @@ Hyphen_spanner::brew_molecule (SCM smob)
       bounds[d] = sp->get_bound (d)->extent (common, X_AXIS)[-d];
     }
   while (flip (&d) != LEFT);
-
-  
   
   Real ss = sp->paper_l ()->get_var ("staffspace");
   Real lt = sp->paper_l ()->get_var ("stafflinethickness");
@@ -82,7 +80,7 @@ Hyphen_spanner::brew_molecule (SCM smob)
        }
     }
   Box b  (Interval (-l/2,l/2), Interval (h,h+th));
-  Molecule mol (sp->lookup_l ()->filledbox (b));
+  Molecule mol (Lookup::filledbox (b));
   mol.translate_axis (bounds.center ()
                      -sp->relative_coordinate (common, X_AXIS),
                      X_AXIS);
index d761dc093c09c4d224980131201db7a028e23ded..7220978207af5ba2cb3fad7c5818d4d8fcfdff22 100644 (file)
@@ -22,7 +22,7 @@ struct Adobe_font_metric : Font_metric
 {
   AFM_Font_info * font_inf_;
 
-  Box get_char (int, bool) const;
+  Box get_char (int, Real mag =1.0) 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,8 +34,9 @@ protected:
   Array<int> ascii_to_metric_idx_;
   Dictionary<int> name_to_metric_dict_;
 
-  Adobe_font_metric (AFM_Font_info*);
+  virtual Molecule find_by_name (String, Real mag = 1.0) const;
 
+  Adobe_font_metric (AFM_Font_info*);
 };
 
 SCM read_afm_file (String fn);
index f705080d32cea8c0992c14d2cbcfe6866b457c0f..ebfd2a2224942679c11cc4d4ba2dda07447234fe 100644 (file)
@@ -29,7 +29,7 @@ public:
   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 , int);
+  Scaled_font_metric* find_scaled (String , Real);
   
   All_font_metrics (String search_path);
   
index bd3a7e7703d145db295035062ef5c7105ea992e1..a105d56f4a2b7c5330b2d2f165be2a83955c71f0 100644 (file)
@@ -25,6 +25,7 @@ struct Box {
   void translate (Offset o);
   /// smallest box enclosing #b#
   void set_empty ();
+  void scale (Real r);
   void unite (Box b);
   Box();
   Box (Interval ix, Interval iy);
index 843fab6ffe9332ecaca7f1af3125f31f1239de4f..e14ebb4e147d0b45197b12608fef1b2863988f8a 100644 (file)
 #include "box.hh"
 #include "lily-guile.hh"
 #include "smobs.hh"
-
+#include "lily-proto.hh"
 
 struct Font_metric
 {
+public:
   SCM name_;
   virtual SCM description () const;
-  virtual Box get_char (int ascii, bool warn) const;
-  virtual ~Font_metric ();
-  virtual Box text_dimension (String) 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;
 
-  DECLARE_SIMPLE_SMOBS(Font_metric,);
+  DECLARE_SMOBS(Font_metric,);
 private:
   Font_metric (Font_metric const&); // no copy.
 protected:
@@ -34,14 +35,14 @@ protected:
 struct Scaled_font_metric : public Font_metric
 {
   virtual SCM description () const;
-  virtual Box text_dimension (String) const;
-
-  static SCM make_scaled_font_metric (Font_metric*, int);
+  virtual Box text_dimension (String, Real) const;
+  virtual Molecule find_by_name (String, Real) const;
+  static SCM make_scaled_font_metric (Font_metric*, Real);
 protected:
   Font_metric *orig_l_;
-  int magstep_i_;
+  Real magnification_f_;
   
-  Scaled_font_metric (Font_metric*,int);
+  Scaled_font_metric (Font_metric*,Real);
 };
 
 Font_metric * unsmob_metrics (SCM s);
index 80e47c21ac120d2f8b5525b45890ee71711eeb63..3a14777e055c374a24b19b60ed3acfd44aa42f7e 100644 (file)
 #ifndef LOOKUP_HH
 #define LOOKUP_HH
 
-#include "smobs.hh"
-#include "lily-guile.hh"
 #include "string.hh"
 #include "molecule.hh"
 #include "flower-proto.hh"
 #include "direction.hh"
 #include "box.hh"
 
-/**
-   handy interface to symbol table
-   TODO: move this into GUILE?
- */
-class Lookup
+struct Lookup
 {
-  Lookup ();
-  Lookup (Lookup const&);
-  DECLARE_SIMPLE_SMOBS(Lookup,);  
-public:
-
-  static SCM make_lookup ();
-  String font_name_;
-  Adobe_font_metric * afm_l_;
-
-  Molecule afm_find (String, bool warn=true) const;
-  Molecule accordion (SCM arg, Real interline_f) const;
-
+  static Molecule accordion (SCM arg, Real interline_f, Font_metric*fm);
   static Molecule frame (Box b, Real thick);
   static Molecule slur (Bezier controls, Real cthick, Real thick) ;
   static Molecule beam (Real, Real, Real) ;
@@ -43,5 +26,5 @@ public:
   static Molecule blank (Box b) ;
   static Molecule filledbox (Box b) ;  
 };
-Lookup* unsmob_lookup (SCM);
+
 #endif // LOOKUP_HH
index 17847564c689ab44e6e793ebb5430250e1410065..11f4ab4224de79aea60f6812fbbf6530c0b975a7 100644 (file)
 */
 class Paper_def : public Music_output_def 
 {
-  Protected_scm lookup_alist_;
 protected:
   VIRTUAL_COPY_CONS(Music_output_def);
 
 public:    
+  Protected_scm style_sheet_;
+  
   virtual ~Paper_def ();
   static int default_count_i_;
   /*
@@ -62,12 +63,10 @@ public:
   SCM get_scmvar (String id)const; 
   void reinit ();
   Paper_def ();
-  void set_lookup (int, SCM lookup_smob);
   Paper_def (Paper_def const&);
 
   Interval line_dimensions_int (int) const;
 
-  Lookup const * lookup_l (int sz) const;      // TODO naming
   virtual int get_next_default_count () const;
   static void reset_default_count();
   void output_settings (Paper_outputter*) const;
index 90a056b60fb9f264fd2f558a82e2f99ed867ac84..61eb4d13ec9eee2958fb98fff629663be8252a42 100644 (file)
@@ -32,12 +32,9 @@ typedef void (Score_element::*Score_element_method_pointer) (void);
    Basic output object.
 */
 class Score_element  {
-  /**
-     The lookup, determined by the font size. Cache this value.
-   */
-  Lookup * lookup_l_;
-
 public:
+  Font_metric * get_default_font ()const;
+  
   SCM immutable_property_alist_;
   SCM mutable_property_alist_;
   Score_element *original_l_;
@@ -78,7 +75,6 @@ public:
     related classes.
    */
   Paper_def *paper_l () const;
-  Lookup const *lookup_l () const;
 
   /**
     add a dependency. It may be the 0 pointer, in which case, it is ignored.
index e5f529a6e369e6e5139947253d536cece16b6095..c84e6723f2a3abc030ed14fdf2ada13db0345e1a 100644 (file)
@@ -34,7 +34,7 @@ public:
                   Real hinf, Real r0);
   Bezier get_bezier () const;
 
-  void minimise_enclosed_area (Paper_def* paper_l, Real beauty, SCM props);
+  void minimise_enclosed_area (Real beauty, SCM props);
   Real fit_factor () const;
   void blow_fit ();
   Real enclosed_area_f () const;
index 098fbe3e912c36410fd29ba7409cfd8e86428e86..12869dcb60203a0f3236fb19aa9c9357dc1c2d79 100644 (file)
@@ -150,7 +150,7 @@ class Tex_font_metric : public Font_metric
 public:
   static  SCM make_tfm (String filename);
 
-  Box get_char (int, bool) const;
+  Box get_char (int,Real = 1.0) const;
   Tex_font_char_metric const *find_ascii (int ascii, bool warn=true) const;
 
   String str () const;
index dcddc27c7498bb2ede2d638770c79e29c869cd66..5960c19696ad0b404fd06972dc70862132945730 100644 (file)
@@ -12,8 +12,9 @@
 #include "key-item.hh"
 #include "molecule.hh"
 #include "paper-def.hh"
-#include "lookup.hh"
+#include "font-metric.hh"
 #include "staff-symbol-referencer.hh"
+#include "lookup.hh"
 
 /*
   FIXME: too much hardcoding here.
@@ -89,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->lookup_l ()->afm_find ("accidentals-" + to_str (a));
+      Molecule m = me->get_default_font ()->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);
     }
@@ -106,7 +107,7 @@ Key_item::brew_molecule (SCM smob)
       Interval x(0, inter);
       Interval y(0,0);
 
-      mol.add_at_edge (X_AXIS, LEFT, me->lookup_l()->blank (Box(x,y)),0);
+      mol.add_at_edge (X_AXIS, LEFT, Lookup::blank (Box(x,y)),0);
       
       for (; gh_pair_p (old); old = gh_cdr (old))
         {
@@ -121,7 +122,7 @@ Key_item::brew_molecule (SCM smob)
                
          if (found == SCM_EOL || gh_cdr (found) != gh_cdar (old))
            {
-              Molecule m =me->lookup_l ()->afm_find ("accidentals-0");
+              Molecule m =me->get_default_font ()->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 b797e02d93837d178e2e7340845b0311828e7c63..ba372c1ec95c409921973e43bf4e56267473b37d 100644 (file)
@@ -8,11 +8,12 @@
 #include "local-key-item.hh"
 #include "molecule.hh"
 #include "staff-symbol-referencer.hh"
-#include "lookup.hh"
+#include "font-metric.hh"
 #include "paper-def.hh"
 #include "musical-request.hh"
 #include "rhythmic-head.hh"
 #include "misc.hh"
+#include "lookup.hh"
 
 SCM
 pitch_less  (SCM p1, SCM p2)
@@ -59,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->lookup_l ()->afm_find (String ("accidentals-("));
-  Molecule close = me->lookup_l ()->afm_find (String ("accidentals-)"));
+  Molecule open = me->get_default_font ()->find_by_name (String ("accidentals-("));
+  Molecule close = me->get_default_font ()->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);
 
@@ -110,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->lookup_l ()->afm_find (String ("accidentals-")
+      Molecule acc (me->get_default_font ()->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->lookup_l ()->afm_find (String ("accidentals-0"));
+         Molecule prefix = me->get_default_font ()->find_by_name (String ("accidentals-0"));
          acc.add_at_edge(X_AXIS, LEFT, Molecule(prefix), 0);
        }
 
@@ -153,7 +154,7 @@ Local_key_item::brew_molecule (SCM smob)
 
        Box b(Interval (0, gh_scm2double (pads[d]) * note_distance),
              Interval (0,0));
-       Molecule m (me->lookup_l ()->blank (b));
+       Molecule m (Lookup::blank (b));
        mol.add_at_edge (X_AXIS, d, m, 0);
       } while ( flip (&d)!= LEFT);
     }
index bdfbd7c158cc881b2741a87bdc012055a7b2da58..1e24db5da75f95619e93c0dbbbe94f46545412a5 100644 (file)
 #include <math.h>
 #include <ctype.h>
 
-#include "lookup.hh"
 #include "warn.hh"
 #include "dimensions.hh"
 #include "bezier.hh"
-#include "paper-def.hh"
 #include "string-convert.hh"
 #include "file-path.hh"
 #include "main.hh"
 #include "lily-guile.hh"
-#include "all-font-metrics.hh"
-#include "afm.hh"
-#include "scope.hh"
 #include "molecule.hh"
-
-
-#include "ly-smobs.icc"
-
-
-Lookup::Lookup ()
-{
-  afm_l_ = 0;  
-}
-
-Lookup::Lookup (Lookup const& s)
-{
-  font_name_ = s.font_name_;
-  afm_l_ = 0;
-}
-
-SCM
-Lookup::mark_smob (SCM s)
-{
-  return s;  
-}
-
-int
-Lookup::print_smob (SCM s, SCM p, scm_print_state*)
-{
-  scm_puts ("#<Lookup >#", p);
-  return 1;
-}
-
-
-IMPLEMENT_UNSMOB(Lookup, lookup);
-IMPLEMENT_SIMPLE_SMOBS(Lookup);
-IMPLEMENT_DEFAULT_EQUAL_P(Lookup);
-
-SCM
-Lookup::make_lookup ()
-{
-  Lookup * l = new Lookup;
-  return l->smobbed_self();
-}
-
-
-Molecule
-Lookup::afm_find (String s, bool warn) const
-{
-  if (!afm_l_)      
-    {
-      Lookup * me = (Lookup*)(this);
-      me->afm_l_ = all_fonts_global_p->find_afm (font_name_);
-      if (!me->afm_l_)
-       {
-         warning (_f ("can't find font: `%s'", font_name_));
-         warning (_f ("(search path: `%s')", global_path.str ().ch_C()));
-         error (_ ("Aborting"));
-       }
-    }
-  AFM_CharMetricInfo const *cm = afm_l_->find_char_metric (s, warn);
-
-  if (!cm)
-    {
-      Molecule m;
-      m.set_empty (false);
-      return m;
-    }
-  
-  SCM at =  (gh_list (ly_symbol2scm ("char"),
-                   gh_int2scm (cm->code),
-                   SCM_UNDEFINED));
-
-
-  at= fontify_atom (afm_l_,at);
-  return Molecule ( afm_bbox_to_box (cm->charBBox), at);
-}
-
-  
-
+#include "lookup.hh"
+#include "font-metric.hh"
 
 Molecule 
 Lookup::beam (Real slope, Real width, Real thick) 
@@ -237,7 +158,7 @@ Lookup::slur (Bezier curve, Real curvethick, Real linethick)
 }
 
 Molecule
-Lookup::accordion (SCM s, Real staff_space) const
+Lookup::accordion (SCM s, Real staff_space, Font_metric *fm) 
 {
   Molecule m;
   String sym = ly_scm2string(gh_car (s));
@@ -245,11 +166,11 @@ Lookup::accordion (SCM s, Real staff_space) const
 
   if (sym == "Discant")
     {
-      Molecule r = afm_find("accordion-accDiscant");
+      Molecule r = fm->find_by_name ("accordion-accDiscant");
       m.add_molecule(r);
       if (reg.left_str(1) == "F")
        {
-         Molecule d = afm_find("accordion-accDot");
+         Molecule d = fm->find_by_name ("accordion-accDot");
          d.translate_axis(staff_space * 2.5 PT, Y_AXIS);
          m.add_molecule(d);
          reg = reg.right_str(reg.length_i()-1);
@@ -277,27 +198,27 @@ Lookup::accordion (SCM s, Real staff_space) const
        }
       if (eflag & 0x02)
        {
-         Molecule d = afm_find("accordion-accDot");
+         Molecule d = fm->find_by_name ("accordion-accDot");
          d.translate_axis(staff_space * 1.5 PT, Y_AXIS);
          m.add_molecule(d);
        }
       if (eflag & 0x04)
        {
-         Molecule d = afm_find("accordion-accDot");
+         Molecule d = fm->find_by_name ("accordion-accDot");
          d.translate_axis(staff_space * 1.5 PT, Y_AXIS);
          d.translate_axis(0.8 * staff_space PT, X_AXIS);
          m.add_molecule(d);
        }
       if (eflag & 0x01)
        {
-         Molecule d = afm_find("accordion-accDot");
+         Molecule d = fm->find_by_name ("accordion-accDot");
          d.translate_axis(staff_space * 1.5 PT, Y_AXIS);
          d.translate_axis(-0.8 * staff_space PT, X_AXIS);
          m.add_molecule(d);
        }
       if (reg.left_str(2) == "SS")
        {
-         Molecule d = afm_find("accordion-accDot");
+         Molecule d = fm->find_by_name ("accordion-accDot");
          d.translate_axis(0.5 * staff_space PT, Y_AXIS);
          d.translate_axis(0.4 * staff_space PT, X_AXIS);
          m.add_molecule(d);
@@ -307,7 +228,7 @@ Lookup::accordion (SCM s, Real staff_space) const
        }
       if (reg.left_str(1) == "S")
        {
-         Molecule d = afm_find("accordion-accDot");
+         Molecule d = fm->find_by_name ("accordion-accDot");
          d.translate_axis(0.5 * staff_space PT, Y_AXIS);
          m.add_molecule(d);
          reg = reg.right_str(reg.length_i()-1);
@@ -315,29 +236,29 @@ Lookup::accordion (SCM s, Real staff_space) const
     }
   else if (sym == "Freebase")
     {
-      Molecule r = afm_find("accordion-accFreebase");
+      Molecule r = fm->find_by_name ("accordion-accFreebase");
       m.add_molecule(r);
       if (reg.left_str(1) == "F")
        {
-         Molecule d = afm_find("accordion-accDot");
+         Molecule d = fm->find_by_name ("accordion-accDot");
          d.translate_axis(staff_space * 1.5 PT, Y_AXIS);
          m.add_molecule(d);
          reg = reg.right_str(reg.length_i()-1);
        }
       if (reg == "E")
        {
-         Molecule d = afm_find("accordion-accDot");
+         Molecule d = fm->find_by_name ("accordion-accDot");
          d.translate_axis(staff_space * 0.5 PT, Y_AXIS);
          m.add_molecule(d);
        }
     }
   else if (sym == "Bayanbase")
     {
-      Molecule r = afm_find("accordion-accBayanbase");
+      Molecule r = fm->find_by_name ("accordion-accBayanbase");
       m.add_molecule(r);
       if (reg.left_str(1) == "T")
        {
-         Molecule d = afm_find("accordion-accDot");
+         Molecule d = fm->find_by_name ("accordion-accDot");
          d.translate_axis(staff_space * 2.5 PT, Y_AXIS);
          m.add_molecule(d);
          reg = reg.right_str(reg.length_i()-1);
@@ -345,14 +266,14 @@ Lookup::accordion (SCM s, Real staff_space) const
       /* include 4' reed just for completeness. You don't want to use this. */
       if (reg.left_str(1) == "F")
        {
-         Molecule d = afm_find("accordion-accDot");
+         Molecule d = fm->find_by_name ("accordion-accDot");
          d.translate_axis(staff_space * 1.5 PT, Y_AXIS);
          m.add_molecule(d);
          reg = reg.right_str(reg.length_i()-1);
        }
       if (reg.left_str(2) == "EE")
        {
-         Molecule d = afm_find("accordion-accDot");
+         Molecule d = fm->find_by_name ("accordion-accDot");
          d.translate_axis(staff_space * 0.5 PT, Y_AXIS);
          d.translate_axis(0.4 * staff_space PT, X_AXIS);
          m.add_molecule(d);
@@ -362,7 +283,7 @@ Lookup::accordion (SCM s, Real staff_space) const
        }
       if (reg.left_str(1) == "E")
        {
-         Molecule d = afm_find("accordion-accDot");
+         Molecule d = fm->find_by_name ("accordion-accDot");
          d.translate_axis(staff_space * 0.5 PT, Y_AXIS);
          m.add_molecule(d);
          reg = reg.right_str(reg.length_i()-1);
@@ -370,25 +291,25 @@ Lookup::accordion (SCM s, Real staff_space) const
     }
   else if (sym == "Stdbase")
     {
-      Molecule r = afm_find("accordion-accStdbase");
+      Molecule r = fm->find_by_name ("accordion-accStdbase");
       m.add_molecule(r);
       if (reg.left_str(1) == "T")
        {
-         Molecule d = afm_find("accordion-accDot");
+         Molecule d = fm->find_by_name ("accordion-accDot");
          d.translate_axis(staff_space * 3.5 PT, Y_AXIS);
          m.add_molecule(d);
          reg = reg.right_str(reg.length_i()-1);
        }
       if (reg.left_str(1) == "F")
        {
-         Molecule d = afm_find("accordion-accDot");
+         Molecule d = fm->find_by_name ("accordion-accDot");
          d.translate_axis(staff_space * 2.5 PT, Y_AXIS);
          m.add_molecule(d);
          reg = reg.right_str(reg.length_i()-1);
        }
       if (reg.left_str(1) == "M")
        {
-         Molecule d = afm_find("accordion-accDot");
+         Molecule d = fm->find_by_name ("accordion-accDot");
          d.translate_axis(staff_space * 2 PT, Y_AXIS);
          d.translate_axis(staff_space PT, X_AXIS);
          m.add_molecule(d);
@@ -396,14 +317,14 @@ Lookup::accordion (SCM s, Real staff_space) const
        }
       if (reg.left_str(1) == "E")
        {
-         Molecule d = afm_find("accordion-accDot");
+         Molecule d = fm->find_by_name ("accordion-accDot");
          d.translate_axis(staff_space * 1.5 PT, Y_AXIS);
          m.add_molecule(d);
          reg = reg.right_str(reg.length_i()-1);
        }
       if (reg.left_str(1) == "S")
        {
-         Molecule d = afm_find("accordion-accDot");
+         Molecule d = fm->find_by_name ("accordion-accDot");
          d.translate_axis(staff_space * 0.5 PT, Y_AXIS);
          m.add_molecule(d);
          reg = reg.right_str(reg.length_i()-1);
@@ -413,22 +334,22 @@ Lookup::accordion (SCM s, Real staff_space) const
      for the rectangle */
   else if (sym == "SB")
     {
-      Molecule r = afm_find("accordion-accSB");
+      Molecule r = fm->find_by_name ("accordion-accSB");
       m.add_molecule(r);
     }
   else if (sym == "BB")
     {
-      Molecule r = afm_find("accordion-accBB");
+      Molecule r = fm->find_by_name ("accordion-accBB");
       m.add_molecule(r);
     }
   else if (sym == "OldEE")
     {
-      Molecule r = afm_find("accordion-accOldEE");
+      Molecule r = fm->find_by_name ("accordion-accOldEE");
       m.add_molecule(r);
     }
   else if (sym == "OldEES")
     {
-      Molecule r = afm_find("accordion-accOldEES");
+      Molecule r = fm->find_by_name ("accordion-accOldEES");
       m.add_molecule(r);
     }
   return m;  
index c0af7c4fd8ba8c22c5b1cec6a8a3c0ca52ed5846..8ff83dafd85bf8df90342f1bbced49a1e8f12be2 100644 (file)
@@ -11,7 +11,7 @@
 #include "musical-request.hh"
 #include "item.hh"
 #include "paper-def.hh"
-#include "lookup.hh"
+#include "font-metric.hh"
 #include "side-position-interface.hh"
 
 ADD_THIS_TRANSLATOR (Lyric_engraver);
index 744e3d6e2174f3719b1e55def8fd0a0adfb9d7b6..91a0d17f78da43dc06f7b5a79f95fd930ba991cd 100644 (file)
@@ -41,7 +41,7 @@ Lyric_extender::brew_molecule (SCM smob)
   Real w = sp->spanner_length () - leftext - righttrim*ss;
   
   Real h = sl * gh_scm2double (sp->get_elt_property  ("height"));
-  Molecule  mol (sp->lookup_l ()->filledbox ( Box (Interval (0,w), Interval (0,h))));
+  Molecule  mol (Lookup::filledbox ( Box (Interval (0,w), Interval (0,h))));
   mol.translate (Offset (leftext, 0));
   return mol.create_scheme();
 }
index b572aa9b1452a95f044b1de935bd89914d56a283..e8d4565e2eccf3094f628429589bd18c2304b70e 100644 (file)
@@ -11,7 +11,7 @@
 #include "debug.hh"
 #include "paper-def.hh"
 #include "paper-column.hh" // urg
-#include "lookup.hh"
+#include "font-metric.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->lookup_l ()->afm_find ("rests-" + to_str (k)));
+         Molecule r (me->get_default_font ()->find_by_name ("rests-" + to_str (k)));
          if (k == 0)
            r.translate_axis (staff_space, Y_AXIS);
          
@@ -124,15 +124,16 @@ Multi_measure_rest::brew_molecule (SCM smob)
   else 
     {
       String idx =  ("rests-") + to_str (-4);
-      s = me->lookup_l ()->afm_find (idx);
+      s = me->get_default_font ()->find_by_name (idx);
     }
   
   mol.add_molecule (s);
 
   if (measures > 1)
     {
-      SCM properties = gh_append2 (me->immutable_property_alist_,
-                                  me->mutable_property_alist_);
+      SCM properties = gh_list (me->mutable_property_alist_,
+                               me->immutable_property_alist_,
+                               SCM_UNDEFINED);
       Molecule s =
        Text_item::text2molecule (me,
                                  ly_str02scm (to_str (measures).ch_C ()),
index 1f0033f86f2383adfe9780dab2a3fcf01f26ba7b..88d00fd5fdfc9a791671e7f7c75cd15b53ccbe62 100644 (file)
@@ -75,6 +75,7 @@ static Keyword_ent the_key_tab[]={
   {"partcombine", PARTCOMBINE},
   {"score", SCORE},
   {"script", SCRIPT},
+  {"stylesheet", STYLESHEET},
   {"skip", SKIP},
   {"textscript", TEXTSCRIPT},
   {"tempo", TEMPO},
index 619520ce954cd4944aa993a5c612e132fd2a2508..6930051b6a9c78b4e54e064eae818760fed1feb8 100644 (file)
@@ -10,7 +10,7 @@
 #include "dots.hh"
 #include "note-head.hh"
 #include "debug.hh"
-#include "lookup.hh"
+#include "font-metric.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->lookup_l()->afm_find ("noteheads-ledgerending");
+  endings[LEFT] = me->get_default_font ()->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->lookup_l()->afm_find (String ("noteheads-") + 
+  Molecule out = me->get_default_font ()->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 7300edd6a60553c66ffca95412ec0df76634e7e0..ba703db23b712aa0957865eab2fc1ecc7f7f3e54 100644 (file)
@@ -12,7 +12,7 @@
 #include "misc.hh"
 #include "paper-def.hh"
 #include "debug.hh"
-#include "lookup.hh"
+#include "font-metric.hh"
 #include "main.hh"
 #include "scope.hh"
 #include "file-results.hh" // urg? header_global_p
 
 Paper_def::Paper_def ()
 {
-  lookup_alist_ = SCM_EOL;
+  style_sheet_ = SCM_EOL;
 }
 
-
 Paper_def::~Paper_def ()
 {
 }
@@ -31,13 +30,7 @@ Paper_def::~Paper_def ()
 Paper_def::Paper_def (Paper_def const&src)
   : Music_output_def (src)
 {
-  SCM n  = SCM_EOL;
-  for (SCM s = src.lookup_alist_; gh_pair_p(s); s = gh_cdr (s))
-    {
-      n = scm_acons (gh_caar(s), gh_cdar (s), n);
-    }
-
-  lookup_alist_  = n;
+  style_sheet_ = src.style_sheet_;
 }
 
 
@@ -87,19 +80,7 @@ Paper_def::line_dimensions_int (int n) const
   return Interval (ind, lw);
 }
 
-void
-Paper_def::set_lookup (int i, SCM l)
-{
-  assert (unsmob_lookup (l));
-  lookup_alist_ = scm_assq_set_x(lookup_alist_, gh_int2scm (i), l);
-}
 
-Lookup const *
-Paper_def::lookup_l (int i) const
-{
-  SCM l = scm_assq (gh_int2scm(i), lookup_alist_);
-  return l == SCM_BOOL_F ? 0 :  unsmob_lookup (gh_cdr (l));
-}
 
 int Paper_def::default_count_i_ = 0;
 
index 0a9cbd2fc53912a228975f389a5401fa2db4a216..8ac3a8703607e0c53afda28994be1a2fab15fd7b 100644 (file)
@@ -20,7 +20,7 @@
 #include "array.hh"
 #include "string-convert.hh"
 #include "debug.hh"
-#include "lookup.hh"
+#include "font-metric.hh"
 #include "main.hh"
 #include "scope.hh"
 #include "identifier.hh"
@@ -137,10 +137,17 @@ Paper_outputter::dump_scheme (SCM s)
 {
   if  (verbatim_scheme_b_)
     {
-      SCM result =  scm_eval2 (scm_listify (ly_symbol2scm ("scm->string"),
-                                          ly_quote_scm (gh_car (s)), SCM_UNDEFINED),
-                              SCM_EOL);
-         
+      SCM p;
+
+      p = scm_mkstrport (SCM_INUM0, 
+                        scm_make_string (SCM_INUM0, SCM_UNDEFINED),
+                        SCM_OPN | SCM_WRTNG,
+                        "Paper_outputter::dump_scheme()");
+
+      SCM wr =scm_eval2 (ly_symbol2scm ("write"), SCM_EOL);
+      scm_apply (wr, s, gh_list (p, SCM_UNDEFINED));
+  
+      SCM result =  scm_strport_to_string (p);
       *stream_p_ << ly_scm2string (result);
     }
   else
index 508d93f24c303d3e9b267bd535a5dbfc93bfd176..5e754287507b804595f1fa6cc195bb8d72e5abdb 100644 (file)
@@ -8,7 +8,7 @@
 
 #include "main.hh"
 #include "debug.hh"
-#include "lookup.hh"
+#include "font-metric.hh"
 #include "spanner.hh"
 #include "paper-def.hh"
 #include "line-of-score.hh"
index fabbc95e57705b33999eff029e01a25a70cc6902..ebc0f0759a0d6cedb15d27fea48615f62267076f 100644 (file)
@@ -179,6 +179,7 @@ yylex (YYSTYPE *s,  void * v_l)
 %token SCRIPT
 %token SKIP
 %token SPANREQUEST
+%token STYLESHEET
 %token COMMANDSPANREQUEST
 %token TEMPO
 %token OUTPUTPROPERTY
@@ -583,6 +584,9 @@ music_output_def_body:
        | music_output_def_body translator_spec_block   {
                $$->assign_translator ($2);
        }
+       | music_output_def_body STYLESHEET embedded_scm {
+               dynamic_cast<Paper_def*> ($$)-> style_sheet_ = $3;
+       }
        | music_output_def_body tempo_request semicolon {
                /*
                        junk this ? there already is tempo stuff in
@@ -590,12 +594,6 @@ music_output_def_body:
                */
                dynamic_cast<Midi_def*> ($$)->set_tempo ($2->dur_.length_mom (), $2->metronome_i_);
        }
-       | music_output_def_body bare_int '=' FONT STRING                { // ugh, what a syntax
-               SCM sl = Lookup::make_lookup();
-               Lookup * l =unsmob_lookup (sl);
-               l->font_name_ = ly_scm2string ($5);
-               dynamic_cast<Paper_def*> ($$)->set_lookup ($2, sl);
-       }
        | music_output_def_body error {
 
        }
index 5e1eea027f7a227eafed7bbfa0e0f0b25db52166..8990f345a3993f7d6a94772891bb1abc2730f815 100644 (file)
@@ -10,7 +10,7 @@
 #include "musical-request.hh"
 #include "score-element.hh"
 #include "item.hh"
-#include "lookup.hh"
+#include "font-metric.hh"
 #include "lily-guile.hh"
 #include "rhythmic-head.hh"
 #include "stem.hh"
index 1ca731b20f751022300ea06a0b231c062a07138c..b6df666dfe025c2fce1a3bfdffdd3365b1059f74 100644 (file)
@@ -8,7 +8,7 @@
 
 #include "molecule.hh"
 #include "paper-def.hh"
-#include "lookup.hh"
+#include "font-metric.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-> lookup_l ()->afm_find (idx).create_scheme();
+  return me-> get_default_font ()->find_by_name (idx).create_scheme();
 }
 
 
index cf188631529d4b35566cb3265218bfa0139895bc..56861ca32fe989f4b32d2856731a57110efe375e 100644 (file)
@@ -10,7 +10,7 @@
 #include "debug.hh"
 #include "molecule.hh"
 #include "paper-def.hh"
-#include "lookup.hh"
+#include "font-metric.hh"
 #include "rest.hh"
 #include "dots.hh"
 #include "paper-score.hh"
diff --git a/lily/scaled-font-metric.cc b/lily/scaled-font-metric.cc
new file mode 100644 (file)
index 0000000..3327b2d
--- /dev/null
@@ -0,0 +1,35 @@
+#include "font-metric.hh"
+#include "string.hh"
+#include "molecule.hh"
+
+
+Scaled_font_metric::Scaled_font_metric (Font_metric* m, Real magn)
+{
+  magnification_f_ = magn;
+  orig_l_ = m;
+}
+
+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
+{
+  return orig_l_->find_by_name (s, magnification_f_ * mag);    // ugh.
+}
index 598c64fc209f0a7e984ca3f2a98ed7ec84b65aee..56d48b775b1fce15d287190588f2a9006da3be60 100644 (file)
@@ -32,9 +32,6 @@ Scheme_hash_table::operator =(Scheme_hash_table const & src)
   // we do not copy the self_scm () field!
 }
 
-
-
-
 SCM
 Scheme_hash_table::mark_smob (SCM s)
 {
index b489d299896b5d7aab16332bd37599443affcf68..2df18842ec05432450582e0f05c49b22a068b9e1 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 "lookup.hh"
+#include "font-metric.hh"
 #include "molecule.hh"
 #include "score-element.hh"
 #include "debug.hh"
@@ -50,7 +51,6 @@ Score_element::Score_element(SCM basicprops)
    */
 
   pscore_l_=0;
-  lookup_l_ =0;
   status_i_ = 0;
   original_l_ = 0;
   immutable_property_alist_ =  basicprops;
@@ -100,7 +100,6 @@ Score_element::Score_element (Score_element const&s)
   mutable_property_alist_ = SCM_EOL;
   
   status_i_ = s.status_i_;
-  lookup_l_ = s.lookup_l_;
   pscore_l_ = s.pscore_l_;
 
   smobify_self ();
@@ -221,25 +220,6 @@ Score_element::paper_l ()  const
  return pscore_l_ ? pscore_l_->paper_l_ : 0;
 }
 
-Lookup const *
-Score_element::lookup_l () const
-{
-  /*
-    URG junkthis, caching is clumsy.
-   */
-  if (!lookup_l_)
-    {
-      Score_element * urg = (Score_element*)this;
-      SCM sz = urg->remove_elt_property ("font-relative-size");
-      int i = (gh_number_p (sz))
-       ? gh_scm2int  (sz)
-       : 0;
-
-      urg->lookup_l_ =  (Lookup*)pscore_l_->paper_l_->lookup_l (i);
-    }
-  return lookup_l_;
-}
-
 void
 Score_element::calculate_dependencies (int final, int busy, SCM funcname)
 {
@@ -895,3 +875,32 @@ 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 10f9627184312dfb374d73c7a45deae8695b4d30..9f03377d5566ce934d72237d77a339da893fcb96 100644 (file)
@@ -9,10 +9,12 @@
 
 #include "debug.hh"
 #include "script.hh"
-#include "lookup.hh"
+#include "font-metric.hh"
 #include "side-position-interface.hh"
 #include "paper-def.hh"
 #include "item.hh"
+#include "molecule.hh"
+#include "lookup.hh"
 
 Molecule
 Script::get_molecule(Score_element * me, Direction d)
@@ -23,12 +25,12 @@ Script::get_molecule(Score_element * me, Direction d)
   SCM key = gh_car  (s);
   if (key == ly_symbol2scm ("feta"))
     {
-      return me->lookup_l ()->afm_find ("scripts-" +
+      return me->get_default_font ()->find_by_name ("scripts-" +
                                    ly_scm2string (index_cell (gh_cdr (s), d)));
     }
   else if (key == ly_symbol2scm ("accordion"))
     {
-      return me->lookup_l ()->accordion (gh_cdr (s), me->paper_l()->get_var("staffspace"));
+      return Lookup::accordion (gh_cdr (s), me->paper_l()->get_var("staffspace"), me->get_default_font ());
     }
   else
     assert (false);
index c3fc491d50c12a8ef47c44aef196bfaa3dbf08e2..4d5c9bdae60a8df82a6f16e9981548a7b39610a2 100644 (file)
@@ -144,7 +144,7 @@ Slur_bezier_bow::area_x_gradients_array (Real area)
   algorithm, instead of this homebrew.
 */
 void
-Slur_bezier_bow::minimise_enclosed_area (Paper_def* paper_l, Real beauty,
+Slur_bezier_bow::minimise_enclosed_area (Real beauty,
                                         SCM bezier_props)
 {
   Real length = curve_.control_[3][X_AXIS]; 
index 25518e8d2f3272b9456b43098004ed8e0dd9b237..4c44b3c1b79eff47b8014657314b383ccaa720ed 100644 (file)
@@ -21,6 +21,7 @@
 #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"
@@ -522,9 +523,9 @@ Slur::brew_molecule (SCM smob)
   Molecule a;
   SCM d =  me->get_elt_property ("dashed");
   if (gh_number_p (d))
-    a = me->lookup_l ()->dashed_slur (one, thick, thick * gh_scm2double (d));
+    a = Lookup::dashed_slur (one, thick, thick * gh_scm2double (d));
   else
-    a = me->lookup_l ()->slur (one, Directional_element_interface::get (me) * thick, thick);
+    a = Lookup::slur (one, Directional_element_interface::get (me) * thick, thick);
 
   return a.create_scheme();
 }
@@ -555,7 +556,7 @@ Slur::set_control_points (Score_element*me)
       if (gh_number_p (ssb))
        sb = gh_scm2double (ssb);
 
-      bb.minimise_enclosed_area (me->paper_l(), sb, details);
+      bb.minimise_enclosed_area ( sb, details);
       SCM sbf = scm_assq (ly_symbol2scm ("force-blowfit"), details);
       Real bff = 1.0;
       if (gh_pair_p (sbf) && gh_number_p (gh_cdr (sbf)))
index 533bf5298a050343bde4923d0f778a3d40158df5..4ffd7dbfdcdd9eff87d61755e6b93fcdc21fa36d 100644 (file)
@@ -7,7 +7,7 @@
 */
 
 #include "span-bar.hh"
-#include "lookup.hh"
+#include "font-metric.hh"
 #include "dimensions.hh"
 #include "paper-def.hh"
 #include "molecule.hh"
index 00aafa5adab08b329d96e87450a663d7d2399f43..ff2bfe4a8660c4abb6c328c933a4a2d71af7df88 100644 (file)
@@ -16,6 +16,7 @@
 #include "spanner.hh"
 
 
+
 MAKE_SCHEME_CALLBACK(Staff_symbol,brew_molecule,1);
 
 SCM
@@ -40,7 +41,7 @@ Staff_symbol::brew_molecule (SCM smob)
   for (int i=0; i < l; i++)
     {
       Molecule a =
-       me->lookup_l ()->filledbox (Box (Interval (0,width),
+       Lookup::filledbox (Box (Interval (0,width),
                                         Interval (-t/2, t/2)));
 
       a.translate_axis (height - i * staff_space (me), Y_AXIS);
index 46d14dcfea6fa82ed2cd6ed1b66baaa46b589c25..0f3e0143756c9d3e58b57a98a43fc3786390293e 100644 (file)
@@ -79,7 +79,7 @@ Stem_tremolo::brew_molecule (SCM smob)
   width *= ss;
   thick *= ss;
   
-  Molecule a (me->lookup_l ()->beam (dydx, width, thick));
+  Molecule a (Lookup::beam (dydx, width, thick));
   a.translate (Offset (-width/2, width / 2 * dydx));
   
   int tremolo_flags;
index f0a78fa2778369e5483d79a5e93b5d2d0475ccd3..2a85ca2487c6320b88afda8f71739b3c628191ff 100644 (file)
 */
 #include <math.h>              // m_pi
 
+#include "lookup.hh"
 #include "directional-element-interface.hh"
 #include "note-head.hh"
 #include "stem.hh"
 #include "debug.hh"
 #include "paper-def.hh"
 #include "rhythmic-head.hh"
-#include "lookup.hh"
+#include "font-metric.hh"
 #include "molecule.hh"
 #include "paper-column.hh"
 #include "misc.hh"
@@ -413,10 +414,10 @@ Stem::flag (Score_element*me)
     }
 
   char c = (get_direction (me) == UP) ? 'u' : 'd';
-  Molecule m = me->lookup_l ()->afm_find (String ("flags-") + to_str (c) + 
+  Molecule m = me->get_default_font ()->find_by_name (String ("flags-") + to_str (c) + 
                                      to_str (flag_i (me)));
   if (!style.empty_b ())
-    m.add_molecule(me->lookup_l ()->afm_find (String ("flags-") + to_str (c) + style));
+    m.add_molecule(me->get_default_font ()->find_by_name (String ("flags-") + to_str (c) + style));
   return m;
 }
 
@@ -465,8 +466,8 @@ Stem::brew_molecule (SCM smob)
   if (!invisible_b (me))
     {
       Real stem_width = gh_scm2double (me->get_elt_property ("thickness")) * me->paper_l ()->get_var ("stafflinethickness");
-      Molecule ss =me->lookup_l ()->filledbox (Box (Interval (-stem_width/2, stem_width/2),
-                                                Interval (stem_y[DOWN]*dy, stem_y[UP]*dy)));
+      Molecule ss =Lookup::filledbox (Box (Interval (-stem_width/2, stem_width/2),
+                                          Interval (stem_y[DOWN]*dy, stem_y[UP]*dy)));
       mol.add_molecule (ss);
     }
 
index b4bd9f53a35b006fd27b6cb432e4298ca06e6ebf..2e931fb9bb2dff136b229845c7eeaf28161ba842 100644 (file)
@@ -8,7 +8,7 @@
  */
 #include "score-element.hh"
 #include "molecule.hh"
-#include "lookup.hh"
+#include "font-metric.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->lookup_l ()->afm_find (idx);
+      Molecule m = e->get_default_font ()->find_by_name (idx);
       if (!m.empty_b ())
        mol.add_at_edge (X_AXIS, RIGHT, m, 0);
     }
index d085267e113212884f25ee60e711a7980513ffd3..cc327778bfe796a7276f36ca4c1e0e31a2684ee9 100644 (file)
 #include "system-start-delimiter.hh"
 #include "paper-def.hh"
 #include "molecule.hh"
-#include "lookup.hh"
+#include "font-metric.hh"
 #include "all-font-metrics.hh"
 #include "score-element.hh"
+#include "lookup.hh"
 
 Molecule
 System_start_delimiter::staff_bracket (Score_element*me,Real height)  
@@ -58,7 +59,7 @@ System_start_delimiter::simple_bar (Score_element*me,Real h)
 {
   Real w = me->paper_l ()->get_var ("stafflinethickness") *
     gh_scm2double (me->get_elt_property ("thickness"));
-  return me->lookup_l ()->filledbox (Box (Interval(0,w), Interval(-h/2, h/2)));
+  return Lookup::filledbox (Box (Interval(0,w), Interval(-h/2, h/2)));
 }
 
 MAKE_SCHEME_CALLBACK(System_start_delimiter,after_line_breaking,1);
index b6fa571c60b5c32043b3a48cf72eef31512f1b4f..e1085702f950a8fc3e653eb43e2c9c4a2c9099a2 100644 (file)
@@ -6,11 +6,12 @@
  (c) 1998--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   Jan Nieuwenhuizen <janneke@gnu.org>
  */
+#include <math.h>
 
 #include "debug.hh"
 #include "text-item.hh"
 #include "paper-def.hh"
-#include "lookup.hh"
+#include "font-metric.hh"
 #include "staff-symbol-referencer.hh"
 #include "staff-symbol-referencer.hh"
 #include "main.hh"
     PROPERTY: (key . value)
     ABBREV: rows lines roman music bold italic named super sub text, or any font-style
  */
+
+/*
+  TODO:
+
+  rewrite routines and syntax to be like
+
+  TEXT: STRING
+      | (head-expression* TEXT*)
+      ;
+
+  head-expression is a list, containing a tag and a variable number of
+  arguments. If necessary, the number of arguments can be stored in a alist,
+
+  '(
+   (tag1 . argcount1)
+   (tag2 . argcount2)
+
+   ... etc
+   
+   )
+
+   or even entries like
+
+   (tag . (argcount function-to-handle-the-tag  ))
+  
+ */
+
 Molecule
-Text_item::text2molecule (Score_element *me, SCM text, SCM properties
+Text_item::text2molecule (Score_element *me, SCM text, SCM alist_chain
 {
   if (gh_string_p (text))
-    return string2molecule (me, text, properties);
+    return string2molecule (me, text, alist_chain);
   else if (gh_list_p (text))
     {
       if (!gh_pair_p (gh_car (text)) && gh_string_p (gh_car (text)))
-       return string2molecule (me, gh_car (text), properties);
+       return string2molecule (me, gh_car (text), alist_chain);
       else
-       return markup_sentence2molecule (me, text, properties);
+       return markup_sentence2molecule (me, text, alist_chain);
     }
   return Molecule ();
 }
 
-static
 SCM
-get_elt_property (Score_element *me, char const *name)
-{
-  SCM s = me->get_elt_property (name);
-  if (s == SCM_EOL)
-    error (_f ("No `%s' defined for %s", name, me->name ()));
-  return s;
-}
-
-Molecule
-Text_item::string2molecule (Score_element *me, SCM text, SCM properties)
+ly_assoc_chain (SCM key, SCM achain)
 {
-  SCM style = scm_assoc (ly_symbol2scm ("font-style"), properties);
-  SCM paper = me->get_elt_property ("style-sheet");
-  if (paper == SCM_EOL)
-    paper = scm_string_to_symbol (me->paper_l ()->get_scmvar ("style_sheet"));
-
-  // should move fallback to scm
-  SCM font_name = ly_str02scm ("cmr10");
-  if (gh_pair_p (style))
+  if (gh_pair_p (achain))
     {
-      SCM f = get_elt_property (me, "style-to-font-name");
-      if (gh_procedure_p (f))
-       font_name = gh_call2 (f, paper, gh_cdr (style));
+      SCM handle = scm_assoc (key, gh_car (achain));
+      if (gh_pair_p (handle))
+       return handle;
+      else
+       return ly_assoc_chain (key, gh_cdr (achain));
     }
   else
+    return SCM_BOOL_F;
+}
+            
+Molecule
+Text_item::string2molecule (Score_element *me, SCM text, SCM alist_chain)
+{
+  SCM style = ly_assoc_chain (ly_symbol2scm ("font-style"),
+                             alist_chain);
+  if  (gh_pair_p (style))
+    style = gh_cdr (style);
+  
+  SCM sheet = me->paper_l ()->style_sheet_;
+  
+  if (gh_symbol_p (style))
     {
-      SCM f = get_elt_property (me, "properties-to-font-name");
-      if (gh_procedure_p (f))
-       font_name = gh_call2 (f, paper, properties);
+      SCM style_alist = gh_cdr (scm_assoc (ly_symbol2scm ("style-alist"), sheet));
+      SCM entry = scm_assoc (style, style_alist);
+      entry = gh_pair_p (entry) ? gh_cdr (entry) : SCM_EOL;
+      alist_chain = gh_cons (entry, alist_chain);
     }
-   
-  SCM lookup = scm_assoc (ly_symbol2scm ("lookup"), properties);
+
+  SCM fonts = gh_cdr (scm_assoc (ly_symbol2scm ("fonts"), sheet));
+  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);
 
   Molecule mol;
   if (gh_pair_p (lookup) && ly_symbol2string (gh_cdr (lookup)) == "name")
@@ -84,47 +116,33 @@ Text_item::string2molecule (Score_element *me, SCM text, SCM properties)
   return mol;
 }
 
-/*
-  caching / use some form of Lookup without 'paper'?
-*/
 Molecule
 Text_item::lookup_character (Score_element *me, SCM font_name, SCM char_name)
 {
   Adobe_font_metric *afm = all_fonts_global_p->find_afm (ly_scm2string (font_name));
-
+  
   if (!afm)
     {
       warning (_f ("can't find font: `%s'", ly_scm2string (font_name)));
       warning (_f ("(search path: `%s')", global_path.str ().ch_C()));
       error (_ ("Aborting"));
     }
+  Font_metric * fm = afm;
   
-  AFM_CharMetricInfo const *metric =
-    afm->find_char_metric (ly_scm2string (char_name), true);
-
-  if (!metric)
-    {
-      Molecule m;
-      m.set_empty (false);
-      return m;
-    }
-
-  SCM list = gh_list (ly_symbol2scm ("char"),
-                     gh_int2scm (metric->code),
-                     SCM_UNDEFINED);
-  
-  list = fontify_atom (afm, list);
-  return Molecule (afm_bbox_to_box (metric->charBBox), list);
+  return fm->find_by_name (ly_scm2string (char_name));
 }
 
+
 Molecule
 Text_item::lookup_text (Score_element *me, SCM font_name, SCM text)
 {
   SCM magnification = me->get_elt_property ("font-magnification");
   Font_metric* metric = 0;
   if (gh_number_p (magnification))
-    metric = all_fonts_global_p->find_scaled (ly_scm2string (font_name),
-                                             gh_scm2int (magnification));
+    {
+      Real realmag = pow (1.2, gh_scm2int (magnification));
+      metric = all_fonts_global_p->find_scaled (ly_scm2string (font_name), realmag);
+    }
   else
     metric = all_fonts_global_p->find_font (ly_scm2string (font_name));
   
@@ -136,26 +154,28 @@ Text_item::lookup_text (Score_element *me, SCM font_name, SCM text)
 
 Molecule
 Text_item::markup_sentence2molecule (Score_element *me, SCM markup_sentence,
-                                    SCM properties)
+                                    SCM alist_chain)
 {
+  SCM sheet = me->paper_l ()->style_sheet_;
+  SCM f = gh_cdr (scm_assoc (ly_symbol2scm ("markup-to-properties"), sheet));
   SCM markup = gh_car (markup_sentence);
   SCM sentence = gh_cdr (markup_sentence);
-  SCM f = get_elt_property (me, "markup-to-properties");
-  SCM p = gh_append2 (gh_call1 (f, markup), properties);
+  
+  SCM p = gh_cons  (gh_call2 (f, sheet, markup), alist_chain);
 
   Axis align = X_AXIS;
-  SCM a = scm_assoc (ly_symbol2scm ("align"), p);
+  SCM a = ly_assoc_chain (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 = scm_assoc (ly_symbol2scm ("kern"), p);
+  SCM k = ly_assoc_chain (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 = scm_assoc (ly_symbol2scm ("raise"), p);
+  SCM r = ly_assoc_chain (ly_symbol2scm ("raise"), p);
   if (gh_pair_p (r) && gh_number_p (gh_cdr (r)))
     raise = gh_scm2double (gh_cdr (r)) * staff_space;
 
@@ -184,8 +204,8 @@ Text_item::brew_molecule (SCM smob)
   
   SCM text = me->get_elt_property ("text");
 
-  SCM properties = gh_append2 (me->immutable_property_alist_,
-                              me->mutable_property_alist_);
+  SCM properties = gh_list (me->immutable_property_alist_,
+                           me->mutable_property_alist_, SCM_UNDEFINED);
 
   Molecule mol = Text_item::text2molecule (me, text, properties);
 
index cfd1bd292fecabd81a96106eca9ffeaef7c705f7..42267504b4981877d1a6458f7aa723bc1172eea9 100644 (file)
@@ -10,7 +10,7 @@
 #include "text-item.hh"
 #include "text-spanner.hh"
 #include "spanner.hh"
-#include "lookup.hh"
+#include "font-metric.hh"
 #include "dimensions.hh"
 #include "paper-def.hh"
 #include "debug.hh"
@@ -55,8 +55,9 @@ Text_spanner::brew_molecule (SCM smob)
     text_style = ly_scm2string (s);
 #endif
 
-  SCM properties = gh_append2 (me->immutable_property_alist_,
-                              me->mutable_property_alist_);
+  SCM properties = gh_list (me->mutable_property_alist_,
+                           me->immutable_property_alist_,
+                           SCM_UNDEFINED);
   SCM edge_text = me->get_elt_property ("edge-text");
   Drul_array<Molecule> edge;
   if (gh_pair_p (edge_text))
index 7b6f0085273458c88c79526b5013904cf9da4949..cdfb8535dde2153b7b29b56af8bf4fe95f36b9d6 100644 (file)
@@ -68,15 +68,17 @@ Tex_font_metric::find_ascii (int ascii, bool warn) const
   else if (warn)
 
     {
-      warning (_f ("can't find ascii character: `%d'", ascii));
+      warning (_f ("can't find ascii character %d", ascii));
     }
   return &dummy_static_char_metric;  
 }
 
 Box
-Tex_font_metric::get_char (int a, bool w) const
+Tex_font_metric::get_char (int a, Real mag) const
 {
-  return find_ascii (a, w)->dimensions ();
+  Box b = find_ascii (a)->dimensions () ;
+  b.scale (mag);
+  return b;
 }
 
 
@@ -104,5 +106,5 @@ Tex_font_metric::make_tfm (String fn)
   tfm_p->char_metrics_ = reader.char_metrics_;
   tfm_p->ascii_to_metric_idx_ = reader.ascii_to_metric_idx_;
   
-  return tfm_p->smobbed_self ();
+  return tfm_p->self_scm ();
 }
index ffbf5f40fa68009290a924dbc847c3140321405c..c68d2ebe203856c7a6adf2c65fe35f7009c871c1 100644 (file)
@@ -7,6 +7,7 @@
 */
 #include <math.h>
 
+
 #include "spanner.hh"
 #include "lookup.hh"
 #include "paper-def.hh"
@@ -324,7 +325,7 @@ Tie::brew_molecule (SCM smob)
       i++;
     }
   
-   Molecule a = me->lookup_l ()->slur (b, Directional_element_interface::get (me) * thick, thick);
+   Molecule a = Lookup::slur (b, Directional_element_interface::get (me) * thick, thick);
    
    return a.create_scheme ();
 }
index 503b24003d4177198ce7d4df61f4716056c39aba..035071ba45cd980bbc9dd6b95ed717dca24fcb9c 100644 (file)
@@ -12,7 +12,7 @@
 #include "text-item.hh"
 #include "time-signature.hh"
 #include "paper-def.hh"
-#include "lookup.hh"
+#include "font-metric.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->lookup_l ()->afm_find (symbolname, false);
+  Molecule m = me->get_default_font ()->find_by_name (symbolname);
   if (!m.empty_b()) 
     return m;
 
   // Second guess: s contains the full signature name
-  m = me->lookup_l ()->afm_find ("timesig-"+s, false);
+  m = me->get_default_font ()->find_by_name ("timesig-"+s);
   if (!m.empty_b ()) 
     return m;
 
@@ -70,18 +70,13 @@ Time_signature::special_time_signature (Score_element*me, String s, int n, int d
 Molecule
 Time_signature::time_signature (Score_element*me,int num, int den)
 {
-  /*
-    UGH: need to look at fontsize.
-    TODO: specify using scm markup.
-   */
-  SCM properties = gh_append2 (me->immutable_property_alist_,
-                              me->mutable_property_alist_);
+  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 ()),
-                                        properties);
+                                        chain);
   Molecule d = Text_item::text2molecule (me,
                                         ly_str02scm (to_str (den).ch_C ()),
-                                        properties);
+                                        chain);
   n.align_to (X_AXIS, CENTER);
   d.align_to (X_AXIS, CENTER);
   Molecule m;
index 14d905fa39772558f34d707f7fbbf867880a11e1..cf4bba50f51f8e319a5967df84f216e99461d1d8 100644 (file)
@@ -10,7 +10,7 @@
 #include "beam.hh"
 #include "box.hh"
 #include "debug.hh"
-#include "lookup.hh"
+#include "font-metric.hh"
 #include "molecule.hh"
 #include "paper-column.hh"
 #include "paper-def.hh"
@@ -76,8 +76,10 @@ Tuplet_spanner::brew_molecule (SCM smob)
       SCM number = me->get_elt_property ("text");
       if (gh_string_p (number) && number_visibility)
        {
-         SCM properties = gh_append2 (me->immutable_property_alist_,
-                                      me->mutable_property_alist_);
+         SCM properties = gh_list ( me->mutable_property_alist_,
+                                    me->immutable_property_alist_,
+                                   
+                                   SCM_UNDEFINED);
          Molecule num = Text_item::text2molecule (me, number, properties);
          num.align_to (X_AXIS, CENTER);
          num.translate_axis (w/2, X_AXIS);
index dbd0cb7ffa3dfd8e561ea1315926f41a033747d2..bb6b6236ad86a4be040bff5535e5049bfbbd3ee9 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "box.hh"
 #include "debug.hh"
-#include "lookup.hh"
+#include "font-metric.hh"
 #include "molecule.hh"
 #include "paper-column.hh"
 #include "paper-def.hh"
@@ -91,8 +91,7 @@ Volta_spanner::brew_molecule (SCM smob)
   Box b (Interval (0, w), Interval (0, h));
   Molecule mol (b, at);
   SCM text = me->get_elt_property("text");
-  SCM properties = gh_append2 (me->immutable_property_alist_,
-                              me->mutable_property_alist_);
+  SCM properties = gh_list (me->mutable_property_alist_, me->immutable_property_alist_,SCM_UNDEFINED);
   Molecule num = Text_item::text2molecule (me, text, properties);
 
   mol.add_at_edge (X_AXIS, LEFT, num, - num.extent (X_AXIS).length ()
index a842af3e9e4add6e3dde4a373e18d61ddbcdcc23..734e8ec4384f279b7cf7996794b462577c9b80e2 100644 (file)
@@ -4,11 +4,7 @@
 
 paper_eleven = \paper {
        staffheight = 11.0\pt;
-       style_sheet = "paper11";
-
-       -1=\font "feta11"
-       -2=\font "feta11"
-       0=\font "feta11"
+       \stylesheet #(make-style-sheet 'paper11)
 
        \include "params.ly";
 }
index 11c7697affaf0c03f15cd0edab634533db58c702..b3269082107c428266651e8084af15a95776cf49 100644 (file)
@@ -4,11 +4,9 @@
 
 paper_thirteen = \paper {
        staffheight = 13.0\pt;
-       style_sheet = "paper13";
-
-       0=\font "feta13"
-       -1=\font "feta11"
 
+       \stylesheet #(make-style-sheet 'paper13)
+       
        \include "params.ly";
 }
 
index f5b6bdb5d536921afaeb80abab630ad773d30b6d..6f202c7bd714cb127de25ebbf88d1ddc7252ed0b 100644 (file)
@@ -4,12 +4,7 @@
 
 paper_sixteen = \paper {
        staffheight = 16.0\pt;
-       style_sheet = "paper16";
-
-       0 = \font "feta16" 
-       -1 = \font "feta13"
-       -2 = \font "feta11"
-       -3 = \font "feta11"
+       \stylesheet #(make-style-sheet 'paper16)
 
        \include "params.ly";
 }
index d4dbebacc93f79c8e7c1b5d4e04a063e9855ce7e..9370521da840888e4fbbf194e25f024c8fb3b8d1 100644 (file)
@@ -5,13 +5,8 @@
 
 paper_twenty = \paper {
        staffheight = 20.0\pt;
-       style_sheet = "paper20";
-
-       0 = \font "feta20"
-       -1 = \font "feta16"
-       -2 = \font "feta13"
-       -3 = \font "feta11"
-
+       \stylesheet #(make-style-sheet 'paper20)
+       
        \include "params.ly";
 }
 
index 79008874ccdd1f23a92e97db96d9e5446f9c7360..62dca4d3620f55917dc60b6716ddaf1e749d0611 100644 (file)
@@ -5,12 +5,7 @@
 
 paper_twentythree = \paper {
        staffheight = 23.0\pt;
-       style_sheet = "paper23";
-
-       -2 = \font "feta16"
-       -1 = \font "feta20"
-       0 = \font "feta23"
-
+       \stylesheet #(make-style-sheet 'paper23)
        \include "params.ly";
 }
 
index 28902384c6bbf665859cc62255bf430cee517982..a3f163fc81fe3155e96e95b62f65150673f40f23 100644 (file)
@@ -4,11 +4,7 @@
 
 paper_twentysix = \paper {
        staffheight = 26.0\pt;
-       style_sheet = "paper26";
-
-       0=\font "feta26"
-       -1 = \font "feta23"
-       -2 = \font "feta20"
+       \stylesheet #(make-style-sheet 'paper26)        
 
        \include "params.ly";
 }
index 209e4da9514820138f6f56a06633a2c6c17d4927..bda61747a1758ec5021672d3caefdc7fd86496fa 100644 (file)
@@ -1,15 +1,4 @@
-% params.ly
-% generic paper parameters
-
-%{
-
-TODO:
-
-* cleanup
-* use elt properties, iso. paper variables.
-
-%}
-
+% JUNKME.
 
 papersizename = \papersize ;
 
@@ -21,104 +10,6 @@ paperfile = \papersize + ".ly";
 staffspace = \staffheight / 4.0;
 stafflinethickness = \staffspace / 10.0;
 
-%{
-The space taken by a note is determined by the formula 
-
-   SPACE = arithmetic_multiplier * ( C + log2 (TIME) ))
-
-where TIME is the amount of time a note occupies.  The value of C is
-chosen such that the smallest space within a measure is
-arithmetic_basicspace:
-
-  C = arithmetic_basicspace - log2 (mininum (SHORTEST, 1/8)) 
-
-The smallest space is the one following the shortest note in the
-measure, or the space following a hypothetical 1/8 note.  Typically
-arithmetic_basicspace is set to a value so that the shortest note
-takes about two noteheads of space (ie, is followed by a notehead of
-space):
-
-   2*quartwidth = arithmetic_multiplier * ( C + log2 (SHORTEST) ))
-
-   { using: C = arithmetic_basicspace - log2 (mininum (SHORTEST, 1/8)) }
-   { assuming: SHORTEST <= 1/8 }
-
-               = arithmetic_multiplier *
-              ( arithmetic_basicspace - log2 (SHORTEST) + log2 (SHORTEST) )
-
-               = arithmetic_multiplier * arithmetic_basicspace
-
-   { choose: arithmetic_multiplier = 1.0*quartwidth (why?)}
-
-               = quartwidth * arithmetic_basicspace
-
-   =>         
-
-   arithmetic_basicspace = 2/1 = 2
-
-If you want to space your music wider, use something like:
-
-   arithmetic_basicspace = 4.;
-
-%}
-% We use 0.9*\quartwidth, because 1.0 seems to wide.
-% quartwidth == 1.32 * staffspace
-% We don't adjust arithmetic_basicspace accordingly (why not?)
-arithmetic_multiplier = 0.9 * 1.32 * \staffspace ;
-arithmetic_basicspace = 2.0;
-
-
-
-% URG: the magic constants for area asymmetry
-bezier_pct_c0 = -0.2;
-bezier_pct_c3 = 0.000006;
-bezier_pct_out_max = 0.8;
-bezier_pct_in_max = 1.2;
-bezier_area_steps = 1.0;
-
-
-% vertical space between lines of text.
-line_kern = \staffspace;
-
-
-% optical correction amount.
-stemSpacingCorrection = 0.5*\staffspace;
-
-
-%{
- relative strength of space following breakable columns (eg. prefatory matter)
- %}
-breakable_column_space_strength = 2.0; 
-
-% space after inline clefs and such get this much stretched
-decrease_nonmus_spacing_factor = 1.0 ;
-
-%{
- space before musical columns (eg. taken by accidentals) get this much
- stretched when they follow a musical column, in absence of grace notes.
-
- 0.0 means no extra space (accidentals are ignored)
-%}
-musical_to_musical_left_spacing_factor = 0.4;
-
-%{
- stretch space this much if there are grace notes before the column
-%}
-before_grace_spacing_factor = 1.2;
-
-%{
-If columns do not have spacing information set, set it to this much
-%}
-loose_column_distance = 2.0 * \staffspace;
-
-%{
-Relative cost of compressing (vs. stretching).  Increasing this
-will cause scores to be set looser
-.
-%}
-
-compression_energy_factor = 0.6;
-
 \translator { \NoteNamesContext }
 \translator { \ScoreContext }
 \translator { \ChoirStaffContext}
index da872eb5677a5ec6bbbde92e78fa59f13de5dbd5..c5fc068d61d15615b067811d6d2567f1c85e67e5 100644 (file)
@@ -10,7 +10,7 @@
               (X-offset-callbacks . (,Side_position::aligned_side))
               (direction . -1)
               (staff-position . 0.0)
-              (meta . ,(element-description "Arpeggio" arpeggio-interface side-position-interface))
+              (meta . ,(element-description "Arpeggio" arpeggio-interface side-position-interface font-interface))
               ))
   
        (BarLine . (
@@ -29,7 +29,7 @@
                (thin-kern . 3.0)
                (hair-thickness . 1.6)
                (thick-thickness . 6.0)
-               (meta . ,(element-description  "BarLine" bar-line-interface ))
+               (meta . ,(element-description  "BarLine" bar-line-interface font-interface))
        ))
 
        (BarNumber . (
                (visibility-lambda . ,begin-of-line-visible)
                (padding . 1.0)
                (direction . 1)
-                (properties-to-font-name . ,properties-to-font-name)
-                (style-to-font-name . ,style-to-font-name)
-                (markup-to-properties . ,markup-to-properties)
                 (font-family . roman)
                (font-relative-size . -1)
                (meta . ,(element-description "BarNumber"
-                       text-interface  break-aligned-interface))
+                       text-interface  font-interface break-aligned-interface))
        ))
 
        (Beam . ,basic-beam-properties)
           (molecule-callback . ,Clef::brew_molecule)
           (before-line-breaking-callback . ,Clef::before_line_breaking)
           (breakable . #t)
+           (font-family . music)          
           (break-align-symbol . Clef_item)
           (visibility-lambda . ,begin-of-line-visible)
           (Y-offset-callbacks  . (,Staff_symbol_referencer::callback)) 
-          (meta . ,(element-description "Clef" clef-interface break-aligned-interface ))
+          (meta . ,(element-description "Clef" clef-interface font-interface break-aligned-interface ))
        ))
 
        (ChordNames . (
                (molecule-callback . ,Chord_name::brew_molecule)
                (after-line-breaking-callback . ,Chord_name::after_line_breaking)
                (chord-name-function . ,default-chord-name-function)
-               (properties-to-font-name . ,properties-to-font-name)
-               (style-to-font-name . ,style-to-font-name)
-               (markup-to-properties . ,markup-to-properties)
-               (font-relative-size . 0)
                (font-family . roman)
-               (font-shape . upright)
-               (meta . ,(element-description "ChordNames" chord-name-interface))
+               (meta . ,(element-description "ChordNames"  font-interface text-interface chord-name-interface))
        ))
 
        (NoteCollision . (
        (Dots . (
                (molecule-callback . ,Dots::brew_molecule)
                (dot-count . 1)
+               (font-family . music)           
                (staff-position . 0.0)
                (Y-offset-callbacks  . (,Dots::quantised_position_callback ,Staff_symbol_referencer::callback))
-               (meta . ,(element-description "Dots" dot-interface ))
+               (meta . ,(element-description "Dots"  font-interface dot-interface ))
        ))
        
        (DynamicText . (
                (Y-offset-callbacks . (,Side_position::aligned_on_self))
                (molecule-callback . ,Text_item::brew_molecule)
                (script-priority . 100)
-               (font-style . dynamic)
-                (properties-to-font-name . ,properties-to-font-name)
-                (style-to-font-name . ,style-to-font-name)
-                (markup-to-properties . ,markup-to-properties)
+               (font-series . bold)
+               (font-family . dynamic)
                (self-alignment-Y . 0)
-               (meta . ,(element-description "DynamicText" text-interface ))
+               (meta . ,(element-description "DynamicText" font-interface  text-interface ))
        ))
        
        (DynamicLineSpanner . (
                (X-offset-callbacks . (,Side_position::centered_on_parent ,Side_position::aligned_on_self))
                (padding .      3.0)
                (self-alignment-X . 0)
-               (font-style . finger)
-                (properties-to-font-name . ,properties-to-font-name)
-                (style-to-font-name . ,style-to-font-name)
-                (markup-to-properties . ,markup-to-properties)
-               (meta . ,(element-description "Fingering" finger-interface text-script-interface text-interface side-position-interface))
+               (font-family . number)
+               (font-relative-size . -3)
+               (meta . ,(element-description "Fingering" finger-interface  font-interface text-script-interface text-interface side-position-interface))
        ))
 
        (GraceAlignment . (
                (molecule-callback . ,Text_item::brew_molecule)         
                (break-align-symbol . Instrument_name)
                (visibility-lambda . ,begin-of-line-visible)
-               (properties-to-font-name . ,properties-to-font-name)
-               (style-to-font-name . ,style-to-font-name)
-               (markup-to-properties . ,markup-to-properties)
                (font-family . roman)
-               (meta . ,(element-description "InstrumentName"  text-interface break-aligned-interface))
+               (meta . ,(element-description "InstrumentName"  font-interface  text-interface break-aligned-interface))
        ))
        
        (KeySignature . (
          (break-align-symbol . Key_item)
          (visibility-lambda . ,begin-of-line-visible)
          (breakable . #t)
-         (meta . ,(element-description "KeySignature" key-signature-interface  break-aligned-interface))
+         (meta . ,(element-description "KeySignature" key-signature-interface  font-interface  break-aligned-interface))
        ))
        
        (Accidentals . (
                (direction . -1)
                (left-padding . 0.2)
                (right-padding . 0.4)
-               (meta . ,(element-description "Accidentals"  accidentals-interface))
+               (meta . ,(element-description "Accidentals"  accidentals-interface font-interface ))
        ))
        
        (LineOfScore . (
                (self-alignment-X . 0)
                (non-rhythmic . #t)
                (word-space . 0.6)
-               
-               (properties-to-font-name . ,properties-to-font-name)
-               (style-to-font-name . ,style-to-font-name)
-               (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))
+               (meta . ,(element-description "LyricText" lyric-syllable-interface text-interface font-interface ))
        ))
        
        (RehearsalMark . (
-         (molecule-callback . ,Text_item::brew_molecule)       
-         (breakable . #t)
-         (properties-to-font-name . ,properties-to-font-name)
-          (style-to-font-name . ,style-to-font-name)
-              (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))
+               (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))
        ))
        
        (MultiMeasureRest . (
                (expand-limit . 10)
                (padding . 2.0) ; staffspace
                (minimum-width . 12.5) ; staffspace
-               (properties-to-font-name . ,properties-to-font-name)
-               (style-to-font-name . ,style-to-font-name)
-               (markup-to-properties . ,markup-to-properties)
-               (font-style . mmrest)
-               (meta . ,(element-description "MultiMeasureRest" multi-measure-rest-interface ))
+               (font-family . number)
+               (font-relative-size . 1)
+               (meta . ,(element-description "MultiMeasureRest" multi-measure-rest-interface  font-interface ))
        ))
        
        (NoteColumn . (
                (molecule-callback . ,Note_head::brew_molecule)
                (Y-offset-callbacks  . (,Staff_symbol_referencer::callback)) 
                (meta . ,(element-description  "NoteHead"
-                       rhythmic-head-interface
+                       rhythmic-head-interface font-interface 
                        note-head-interface ))
        ))
 
        (NoteName . (
                (style . default)
                (molecule-callback . ,Text_item::brew_molecule)
-                (properties-to-font-name . ,properties-to-font-name)
-                (style-to-font-name . ,style-to-font-name)
-                (markup-to-properties . ,markup-to-properties)
-               (font-family . roman)
-               (font-shape . upright)
-               (font-relative-size . 0)
                (meta . ,(element-description  "NoteName"
-                                              note-name-interface
+                                              note-name-interface font-interface
                                               general-element-interface))
                ))
 
                (Y-offset-callbacks . (,Side_position::aligned_side))
                (molecule-callback . ,Text_item::brew_molecule)
                 (font-shape . italic)
-                (properties-to-font-name . ,properties-to-font-name)
-                (style-to-font-name . ,style-to-font-name)
-                (markup-to-properties . ,markup-to-properties)
-
-               (meta . ,(element-description "OctavateEight" text-interface ))
+               (meta . ,(element-description "OctavateEight" text-interface font-interface ))
        ))
        
        (PaperColumn . (
        (Script . (
                (molecule-callback . ,Script::brew_molecule)
                (X-offset-callbacks . (,Side_position::centered_on_parent))
-               (meta . ,(element-description "Script" script-interface side-position-interface))
+               (meta . ,(element-description "Script" script-interface side-position-interface font-interface))
        ))
        
        (ScriptColumn . (
                (molecule-callback . ,Text_item::brew_molecule)         
                (break-align-symbol . Clef_item)
                (visibility-lambda . ,begin-of-line-visible)
-               (properties-to-font-name . ,properties-to-font-name)
-                (style-to-font-name . ,style-to-font-name)
-                (markup-to-properties . ,markup-to-properties)
                (font-family . roman)
-(meta . ,(element-description "StanzaNumber" break-aligned-interface text-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)
-                (properties-to-font-name . ,properties-to-font-name)
-                (style-to-font-name . ,style-to-font-name)
-                (markup-to-properties . ,markup-to-properties)
-               
                (self-alignment-X . 0)
-               (meta . ,(element-description "SostenutoPedal" text-interface ))
+               (meta . ,(element-description "SostenutoPedal" text-interface  font-interface))
        ))
 
        (Stem . (
                ; if stem is on middle line, choose this direction.
                (default-neutral-direction . 1)
                (X-offset-callbacks . (,Stem::off_callback))            
-               (meta . ,(element-description  "Stem" stem-interface ))
+               (meta . ,(element-description  "Stem" stem-interface  font-interface))
        ))
 
        (StemTremolo . (
                (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))
+               (meta . ,(element-description "SustainPedal" sustain-pedal-interface side-position-interface font-interface))
        ))
 
        (SystemStartDelimiter . (
                (molecule-callback . ,Text_item::brew_molecule)
                (no-spacing-rods . #t)
                (padding . 0.5)
-               (properties-to-font-name . ,properties-to-font-name)
-               (style-to-font-name . ,style-to-font-name)
-               (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-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)
-                (properties-to-font-name . ,properties-to-font-name)
-                (style-to-font-name . ,style-to-font-name)
-                (markup-to-properties . ,markup-to-properties)
                (type . "line")
                (direction . 1)
-               (meta . ,(element-description "TextSpanner" text-spanner-interface ))           
+               (meta . ,(element-description "TextSpanner" text-spanner-interface  font-interface))            
        ))
        (Tie . (
                (molecule-callback . ,Tie::brew_molecule)
        ))
 
        (TimeSignature . (
-               (molecule-callback . ,Time_signature::brew_molecule)
+                (molecule-callback . ,Time_signature::brew_molecule)
                (break-align-symbol . Time_signature)
                (visibility-lambda . ,all-visible)
                (breakable . #t)
-                (properties-to-font-name . ,properties-to-font-name)
-                (style-to-font-name . ,style-to-font-name)
-                (markup-to-properties . ,markup-to-properties)
-                (font-style . timesig)
-               
-               (meta . ,(element-description "TimeSignature" time-signature-interface ))
+                (font-family . number)
+                (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)
-                (properties-to-font-name . ,properties-to-font-name)
-                (style-to-font-name . ,style-to-font-name)
-                (markup-to-properties . ,markup-to-properties)
-                (font-style . tuplet)
+               (font-shape . italic)
+               (font-relative-size . -1)
                (meta .  ,(element-description "TupletBracket" text-interface
-                          tuplet-bracket-interface))
+                          tuplet-bracket-interface font-interface))
        ))
 
        (UnaChordaPedal . (
                (molecule-callback . ,Text_item::brew_molecule)
                 (font-shape . italic)
-                (properties-to-font-name . ,properties-to-font-name)
-                (style-to-font-name . ,style-to-font-name)
-                (markup-to-properties . ,markup-to-properties)
                (no-spacing-rods . #t)
                (self-alignment-X . 0)
                (X-offset-callbacks . (,Side_position::aligned_on_self))
                (Y-offset-callbacks .
                 (,Side_position::aligned_side
                  ,Side_position::centered_on_parent))
-               (meta . ,(element-description "UnaChordaPedal" text-interface ))
+               (meta . ,(element-description "UnaChordaPedal" text-interface font-interface))
        ))
 
        (VoltaBracket . (
                (molecule-callback . ,Volta_spanner::brew_molecule)
                (direction . 1)
                (padding . 5)
-                (properties-to-font-name . ,properties-to-font-name)
-                (style-to-font-name . ,style-to-font-name)
-                (markup-to-properties . ,markup-to-properties)
-                (font-style . volta)
-       
+               (font-family . number)
+               (font-relative-size . -2)
                (thickness . 1.6)  ;  stafflinethickness
                (height . 2.0) ; staffspace;
                (minimum-space . 25)
-               (meta . ,(element-description "VoltaBracket" volta-bracket-interface side-position-interface))
+               (meta . ,(element-description "VoltaBracket" volta-bracket-interface side-position-interface font-interface))
        ))
 
        (VerticalAlignment . (
index 955fe0dcf52b5c9d6f786d39c842f483948040bc..d41741cb6118c6e76d4521144bdb0e6c236290ca 100644 (file)
@@ -8,16 +8,6 @@
 
 (define style-to-font-alist
   `(
-    (finger . ((font-family . number) (font-relative-size . -3)))
-    (volta . ((font-family . number) (font-relative-size . -2)))
-    (tuplet . ((font-family . roman) (font-shape . italic) (font-relative-size . -1)))
-    (timesig . ((font-family .  number) (font-relative-size . 0)))
-    (mmrest . ((font-family . number) (font-relative-size . 1)))
-    (mark . ((font-family . number) (font-relative-size . 1)))
-    (script . ((font-family . roman) (font-relative-size . -1)))
-    (large . ((font-family . roman) (font-relative-size . 1)))
-    (Large . ((font-series . bold) (font-family . roman) (font-relative-size . 2)))
-    (dynamic . ((font-series . bold) (font-family . dynamic) (font-relative-size . 0)))
 ))
 
 (define (font-field name font-descr)
 
 (define paper20-style-sheet-alist
   '(
-    ((2 medium upright music feta 26) . "feta26")
-    ((1 medium upright music feta 23) . "feta23")
-    ((0 medium upright music feta 20) . "feta20")
-    ((-1 medium upright music feta 16) . "feta16")
-    ((-2 medium upright music feta 13) . "feta13")
-    ((-3 medium upright music feta 11) . "feta11")
-    ((-4 medium upright music feta 11) . "feta11")
-    ((2 medium upright braces feta-braces 26) . "feta-braces26")
-    ((1 medium upright braces feta-braces 23) . "feta-braces23")
-    ((0 medium upright braces feta-braces 20) . "feta-braces20")
-    ((-1 medium upright braces feta-braces 16) . "feta-braces16")
-    ((-2 medium upright braces feta-braces 13) . "feta-braces13")
-    ((-3 medium upright braces feta-braces 11) . "feta-braces11")
-    ((2 medium italic roman cmti 12) . "cmti14")
-    ((1 medium italic roman cmti 12) . "cmti12")
-    ((0 medium italic roman cmti 10) . "cmti10")
-    ((-1 medium italic roman cmti 10) . "cmti8")
-    ((-2 medium italic roman cmti 10) . "cmti7")
-    ((-3 medium italic roman cmti 10) . "cmti6")
-    ((3 bold italic dynamic feta 16) . "feta-din16")
-    ((2 bold italic dynamic feta 16) . "feta-din16")
-    ((1 bold italic dynamic feta 13) . "feta-din13")
-    ((0 bold italic dynamic feta 11) . "feta-din11")
-    ((-1 bold italic dynamic feta 10) . "feta-din10")
-    ((-2 bold italic dynamic feta 8) . "feta-din8")
-    ((-3 bold italic dynamic feta 7) . "feta-din7")
-    ((-4 bold italic dynamic feta 5) . "feta-din5")
-    ((-5 bold italic dynamic feta 4) . "feta-din4")
     ((3 medium upright number feta-nummer 13) . "feta-nummer13")
     ((2 medium upright number feta-nummer 13) . "feta-nummer13")
     ((1 medium upright number feta-nummer 11) . "feta-nummer11")
     ((0 medium upright number feta-nummer 10) . "feta-nummer10")
     ((-1 medium upright number feta-nummer 8) . "feta-nummer8")
-    ((-2 medium upright number feta-nummer 7) . "feta-nummer7")
+    ((-2 medium upright number feta-nummer 6) . "feta-nummer6")
     ((-3 medium upright number feta-nummer 5) . "feta-nummer5")
     ((-4 medium upright number feta-nummer 4) . "feta-nummer4")
-    ((2 bold upright roman cmbx 14) . "cmbx14")
-    ((1 bold upright roman cmbx 12) . "cmbx12")
-    ((1 medium upright roman cmr 12) . "cmr12")
     ((0 medium upright roman cmr 10) . "cmr10")
+    ((1 medium upright roman cmr 12) . "cmr12")
     ((-1 medium upright roman cmr 8) . "cmr8" )
     ((-2 medium upright roman cmr 7) . "cmr7" )
     ((-3 medium upright roman cmr 6) . "cmr6" )
     ((-4 medium upright roman cmr 5) . "cmr5" )
     ((-5 medium upright roman cmr 4) . "cmr4" )
+    ((-1 medium italic roman cmti 8) . "cmti8")    
+    ((0 medium italic roman cmti 10) . "cmti10")
+    ((1 medium italic roman cmti 12) . "cmti12")
+    ((2 bold upright roman cmbx 10) . "cmbx10")
+    ((1 bold upright roman cmbx 12) . "cmbx12")
+    ((2 bold upright roman cmbx 14) . "cmbx14")
+    ((-3 medium upright math msam 10) . "msam10")
+    ((-2 medium upright math msam 10) . "msam10")
+    ((-1 medium upright math msam 10) . "msam10")
     ((0 medium upright math msam 10) . "msam10")
+    ;; should use the same brace font every where and fix C++ code.
+    ((0 medium upright braces feta-braces 20) . "feta-braces20")
+    ((2 medium upright braces feta-braces 26) . "feta-braces26")
+    ((1 medium upright braces feta-braces 23) . "feta-braces23")
+    ((3 bold italic dynamic feta 16) . "feta-din16")
+    ((2 bold italic dynamic feta 16) . "feta-din16")
+    ((3 bold italic dynamic feta 10) . "feta-din13")
+    ((2 bold italic dynamic feta 10) . "feta-din13")
+    ((1 bold italic dynamic feta 10) . "feta-din12")
+    ((0 bold italic dynamic feta 10) . "feta-din10")
+    ((-1 bold italic dynamic feta 10) . "feta-din8")
+    ((-2 bold italic dynamic feta 10) . "feta-din7")
+    ((-3 bold italic dynamic feta 10) . "feta-din6")
+    ((-4 bold italic dynamic feta 10) . "feta-din5")
+    ((-5 bold italic dynamic feta 10) . "feta-din4")
+    ((0 medium upright music feta 20) . "feta20")
+    ((-1 medium upright music feta 16) . "feta16")
+    ((-2 medium upright music feta 13) . "feta13")
+    ((-3 medium upright music feta 13) . "feta11")
+    ((-4 medium upright music feta 13) . "feta11")
+    ((1 medium upright music feta 23) . "feta23")
+    ((2 medium upright music feta 26) . "feta26")
     ((-1 medium upright math msam 10) . "msam10")
     ((-2 medium upright math msam 10) . "msam10")
     ((-3 medium upright math msam 10) . "msam10")
-    ))
-
+   ))
 
 ;; return a FONT-DESCR with relative size decremented by DECREMENT
 (define (change-relative-size font-desc decrement)
 
 
 ;; make style sheet for each paper version.
-(define style-sheet-alist
+(define font-list-alist
   (map-alist-vals (lambda (x) (change-style-sheet-relative-size
                               paper20-style-sheet-alist x))
                  '((paper11 . -3)
   )
 
 
-(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))
-             '())))))
+(define (make-style-sheet sym)
+  `((fonts . ,(cdr (assoc sym font-list-alist)))
+    (font-defaults
+     . ((font-family . music)
+       (font-relative-size . 0)
+       (font-shape . upright)
+       (font-series . medium)
+       ))
+    (style-alist
+     . ((finger . ((font-family . number) (font-relative-size . -3)))
+       (volta . ((font-family . number) (font-relative-size . -2)))
+       (tuplet . ((font-family . roman) (font-shape . italic) (font-relative-size . -1)))
+       (timesig . ((font-family .  number) (font-relative-size . 0)))
+       (mmrest . ((font-family . number) (font-relative-size . 1)))
+       (mark . ((font-family . number) (font-relative-size . 1)))
+       (script . ((font-family . roman) (font-relative-size . -1)))
+       (large . ((font-family . roman) (font-relative-size . 1)))
+       (Large . ((font-series . bold) (font-family . roman) (font-relative-size . 2)))
+       (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)))
+       (lines . ((align . 1)))
+       (roman . ((font-family . roman)))
+       (music . ((font-family . music) (font-shape . upright) (font-series . medium)))
+       (finger . ((font-style . finger)))
+       (bold . ((font-series . bold)))
+       (italic . ((font-shape . italic)))
+       (named . ((lookup . name)))
+       (super . ((raise . 1) (font-relative-size . -1)))
+       (sub . ((raise . -1) (font-relative-size . -1)))
+       (text . ((lookup . value)))
+       )
+     )
+    
+    )
+  )
 
 ;; reduce the font list by successively applying a font-qualifier.
-(define (qualifiers-to-fontname  qualifiers font-descr-alist)
+(define (qualifiers-to-fontnames  qualifiers font-descr-alist)
   (if (null? qualifiers)
-      (if (null? font-descr-alist)
-         ""  
-         (cdar font-descr-alist))      ; return the topmost.
+      font-descr-alist
       
-      (qualifiers-to-fontname
+      (qualifiers-to-fontnames
        (cdr qualifiers)
        (filter-field (caar qualifiers) (cdar qualifiers) font-descr-alist)
       )
   ))
 
-(define (properties-to-font-name paper properties-alist)
+
+;; does FONT-DESC satisfy QUALIFIERS?
+(define (font-qualifies? qualifiers font-desc)
+  (if (null? qualifiers) #t
+      (if (eq? (font-field (caar qualifiers) font-desc) (cdar qualifiers))
+         (font-qualifies? (cdr qualifiers) font-desc)
+         #f
+         )
+       )
+  )
+
+(define (find-first-font qualifiers fonts)
+  (if (null? fonts)
+      ""
+      (if (font-qualifies? qualifiers (caar fonts))
+         (cdar fonts)
+         (find-first-font qualifiers (cdr fonts))
+       )
+      ))
+
+
+;; return a single font from FONTS (or a default, if none found)
+;; and warn if the selected font is not unique.
+(define (select-unique-font qualifiers fonts)
   (let*  (
-         (fonts (cdr (assoc paper style-sheet-alist)))
+         (err (current-error-port))
+         )
+    
 
+  (if (not (= (length fonts) 1))
+      (begin
+       (display "\ncouldn't find unique font satisfying " err)
+       (write qualifiers err)
+       (display " found " err)
+         (if (null? fonts)
+             (display "none" err)
+             (write (map cdr  fonts) err))
+         ))
+
+  (if (null? fonts)
+      "cmr10"
+      (cdar fonts))    ; return the topmost.
+  
+  ))
+
+
+(define (chain-assoc x alist-list)
+  (if (null? alist-list)
+      #f
+      (let* (
+            (handle (assoc x (car alist-list)))
+            )
+       (if (pair? handle)
+           handle
+           (chain-assoc x (cdr alist-list))
+           )
+       )
+      )
+  )
+
+;; TODO
+;; add support for override by font-name
+;; very often-used; hard-code in C++, and use SCM glue code.
+
+(define (properties-to-font-name fonts properties-alist-list)
+  (let*  (
          ;; change order to change priorities of qualifiers.
          (q-order    '(font-name font-family font-series font-shape font-point-size font-relative-size))
-         (rawqualifiers (map (lambda (x) (assoc x  properties-alist))
+         (rawqualifiers (map (lambda (x) (chain-assoc x  properties-alist-list))
                              q-order))
-                       
          (qualifiers (filter-list pair? rawqualifiers))
-         (fontnm (qualifiers-to-fontname qualifiers fonts))
-         (err (current-error-port))
+         (selected     (find-first-font qualifiers fonts))
+         (err (current-error-port))      
          )
 
-    (if (eq? fontnm "")
+    (if (equal? selected "")
        (begin
-         (display "\ncouldn't find font satisfying " err)
+         (display "\ncouldn't find any font satisfying " err)
          (write qualifiers err)
-         (display "\n" err)      
          "cmr10"
          )
-       fontnm)
-       
-
+       selected)       ; return the topmost.
     ))
 
-
-(define markup-abbrev-to-properties-alist
-  (append
-   '(
-     (rows . ((align . 0)))
-     (lines . ((align . 1)))
-     (roman . ((font-family . roman)))
-     (music . ((font-family . music)))
-     (finger . ((font-style . finger)))
-     (bold . ((font-series . bold)))
-     (italic . ((font-shape . italic)))
-     (named . ((lookup . name)))
-     (super . ((raise . 1) (font-relative-size . -1)))
-     (sub . ((raise . -1) (font-relative-size . -1)))
-     (text . ((lookup . value)))
-     )
-   (map (lambda (x) (cons (car x) (cons 'font-style (car x))))
-       style-to-font-alist)))
-  
-(define (markup-to-properties markup)
+(define (markup-to-properties sheet markup)
   ;;(display "markup: `")
-  ;;(display markup)
+  ;;(write markup)
   ;;(display "'\n")
   (if (pair? markup)
       (list markup)
-      (let ((entry (assoc markup markup-abbrev-to-properties-alist)))
-       (if entry (cdr entry)
+      (let ((entry (assoc markup
+                         ;; assoc-chain?
+                         (append (cdr (assoc 'abbreviation-alist sheet))
+                                 (cdr (assoc 'style-alist sheet))))))
+       (if entry
+           (cdr entry)
            (list (cons markup #t))))))
 
 ; fixme, how's this supposed to work?
 ; and why don't we import font-setting from elt?
-(define (style-to-font-name paper style)
+(define (style-to-font-name sheet style)
   (let* ((entry (assoc style style-to-font-alist))
-        (qs (if entry (cdr entry) '()))
-        (sheet (cdr (assoc paper style-sheet-alist)))
-        (fontnm (qualifiers-to-fontname qs sheet))
-        (err (current-error-port)))
-    (if (eq? fontnm "")
+        (qualifiers (if entry (cdr entry) '()))
+        (font (find-first-font qualifiers sheet))
+        (err (current-error-port))
+        )
+
+    (if (equal? font "")
        (begin
-         (display "\ncouldn't find font satisfying " err)
-         (display qs err)
-         (display "\n" err)      
-         "cmr10")
-       fontnm)))
+         (display "\ncouldn't find any font satisfying " err)
+         (write qualifiers err)
+         "cmr10"
+         )
+       font)   ; return the topmost.
+    ))
 
-                           
+                   
 
 
 ; (define (test-module)
index 5e79f3d764059e36c5b7bfa0c8701534cd52cfa8..dfbe409892693ebae3a26c2fa2bfe20f5d898f65 100644 (file)
@@ -388,6 +388,21 @@ Align_interface::center_on_element). ")
     (property-description 'dot-count integer? "number of dots")
     )))
 
+(define font-interface
+  (lily-interface
+   'font-interface
+   "Any symbol that is typeset through fixed sets of glyphs (ie. fonts)"
+   (list
+    (property-description 'font-style symbol? "a precooked set of font definitions, eg. finger volta timesig mark script large Large dynamic")
+    (property-description 'font-series symbol? "partial font definition: medium, bold")
+    (property-description 'font-shape symbol?  "partial font definition: upright or italic")
+    (property-description 'font-family symbol? "partial font definition: music roman braces dynamic math ...")
+    (property-description 'font-name symbol? "partial font definition: base name of font file FIXME: should override other partials")
+    (property-description 'font-point-size number? "partial font definition: exact font size in points FIXME: should override font-relative-size")
+    (property-description 'font-relative-size number? "partial font definition: the relative size, 0 is style-sheet's normal size, -1 is smaller, +1 is bigger")
+    )))
+
+
 (define text-interface
   (lily-interface
    'text-interface
@@ -424,14 +439,6 @@ The following abbreviations are currently defined:
 <dt> any font-style<dd> finger volta timesig mmrest mark script large Large dynamic
 </dl>
 " )
-    (property-description 'font-style symbol? "font definition for a special purpose, one of: finger volta timesig mark script large Large dynamic")
-    (property-description 'font-series symbol? "partial font definition: medium, bold")
-    (property-description 'font-shape symbol?  "partial font definition: upright or italic")
-    (property-description 'font-family symbol? "partial font definition: music roman braces dynamic math ...")
-    (property-description 'font-name symbol? "partial font definition: base name of font file FIXME: should override other partials")
-    (property-description 'font-point-size number? "partial font definition: exact font size in points FIXME: should override font-relative-size")
-    (property-description 'font-relative-size number? "partial font definition: the relative size, 0 is style-sheet's normal size, -1 is smaller, +1 is bigger")
-
     ;; Should move this somewhere else?  
     (property-description 'align number? "the alignment of the text, 0 is horizontal, 1 is vertical")
     (property-description 'lookup symbol? "lookup method: 'value for plain text, 'name for character-name")