]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/grob.cc (get_stencil): simplify: use callback mechanism to
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 16 Oct 2005 11:36:37 +0000 (11:36 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 16 Oct 2005 11:36:37 +0000 (11:36 +0000)
calculate stencil.
(get_print_stencil): rename from get_stencil: create stencil with
transparency, color and cause.

* scm/define-grobs.scm: change print-function to stencil callback everywhere.

* python/convertrules.py (conv): insert temporary warning rule.

* lily/multi-measure-rest.cc (set_text_rods): use stencil directly.

* lily/grob-property.cc (try_callback): remove marker if applicable.

* lily/grob.cc: elucidate doc about after/before-line-breaking

* lily/slur-scoring.cc (enumerate_attachments): robustness fix.

* lily/stem.cc (height): idem.

* lily/stem-tremolo.cc: idem.

* lily/slur.cc (height): don't use get_uncached_stencil()

* lily/grob.cc: change after/before-line-breaking-callback to
after/before-line-breaking dummy properties.

* lily/include/grob.hh: remove Grob_status.

* lily/slur-scoring.cc (calc_control_points): use callback

* lily/slur.cc (calc_direction): use callback.

* lily/grob.cc (other_axis_parent_positioning): new function.
(same_axis_parent_positioning): new function

* lily/stem.cc (calc_stem_end_position): use callback.
(calc_positioning_done): idem.
(calc_direction): idem.
(calc_stem_end_position): idem
(calc_stem_info): idem.

* lily/grob-property.cc (get_property_data): new function:
(try_callback): new function.

13 files changed:
ChangeLog
Documentation/user/changing-defaults.itely
lily/grob-property.cc
lily/grob.cc
lily/include/grob.hh
lily/multi-measure-rest.cc
lily/slur-scoring.cc
lily/slur.cc
lily/stem-tremolo.cc
lily/stem.cc
lily/system.cc
python/convertrules.py
scm/define-grobs.scm

index 78256a04143b4829221176e4ed610a20132ef7bf..778d637a63664e26e0dbacb7284ee8ad081346fb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,28 @@
 2005-10-16  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * lily/grob.cc (get_stencil): simplify: use callback mechanism to
+       calculate stencil.
+       (get_print_stencil): rename from get_stencil: create stencil with
+       transparency, color and cause. 
+
+       * scm/define-grobs.scm: change print-function to stencil callback everywhere.
+
+       * python/convertrules.py (conv): insert temporary warning rule.
+
+       * lily/multi-measure-rest.cc (set_text_rods): use stencil directly.
+
+       * lily/grob-property.cc (try_callback): remove marker if applicable.
+
+       * lily/grob.cc: elucidate doc about after/before-line-breaking
+
+       * lily/slur-scoring.cc (enumerate_attachments): robustness fix.
+
+       * lily/stem.cc (height): idem.
+
+       * lily/stem-tremolo.cc: idem.
+
+       * lily/slur.cc (height): don't use get_uncached_stencil()
+
        * lily/rest.cc (y_offset_callback): use offset callback
        iso. after-line-breaking callback.
 
index a6ef7ee4dff703fd9e7d3a6ce7c2f46bc87e1ca4..97adb3e0c30d2fe00a61b0ec3d1eda25e1893509 100644 (file)
@@ -1277,6 +1277,9 @@ are cloned.  A separate object is created for every system that it is
 in.  These are clones of the original object and inherit all
 properties, including @code{\override}s.
 
+
+[THIS SECTION IS OUT OF DATE. REWRITE ME.] 
+
 In other words, an @code{\override} always affects all pieces of a
 broken spanner.  To change only one part of a spanner at a line break,
 it is necessary to hook into the formatting process.  The
@@ -1301,8 +1304,8 @@ if yes, it sets @code{extra-offset}.
 This procedure is installed into @internalsref{Tie}, so the last part
 of the broken tie is translated up.
 
-
-@lilypond[quote,verbatim,raggedright]
+@ignore
+@li lypond[quote,verbatim,raggedright]
 #(define (my-callback grob)
   (let* (
          ; have we been split? 
@@ -1322,6 +1325,7 @@ of the broken tie is translated up.
   c1 ~ \break c2 ~ c
 }
 @end lilypond
+@end ignore
 
 @noindent
 When applying this trick, the new @code{after-line-breaking-callback}
@@ -1329,6 +1333,8 @@ should also call the old @code{after-line-breaking-callback}, if there
 is one.  For example, if using this with @code{Slur},
 @code{Slur::after_line_breaking} should also be called.
 
+[END OUT OF DATE]
+
 
 @item Some objects cannot be changed with @code{\override} for
 technical reasons. Examples of those are @code{NonMusicalPaperColumn}
index 34f1652c90fc2d9ebc9984aa0b1a9d057498f369..b1689fd3caf00690311f297779c3c0d3048eb2f5 100644 (file)
@@ -196,7 +196,11 @@ Grob::try_callback (SCM sym)
            call.
           */
          if (value == SCM_UNSPECIFIED)
-           value = internal_get_property (sym);
+           {
+             value = internal_get_property (sym);
+             if (value == marker)
+               mutable_property_alist_ = scm_assq_remove_x (mutable_property_alist_, marker);
+           }
          else
            internal_set_property (sym, value);
          
index 95208d3a16a23ffab6e76203f353bc9acc5d9e05..b85e61824d12a5ece5211269e2e000a6e54e8f4e 100644 (file)
@@ -33,7 +33,7 @@ SCM
 Grob::same_axis_parent_positioning (SCM element_smob, SCM axis)
 {
   Grob *me = unsmob_grob (element_smob);
-  Axis ax = other_axis ((Axis)scm_to_int (axis));
+  Axis ax = Axis (scm_to_int (axis));
   
   Grob *par = me->get_parent (ax);
   if (par)
@@ -146,7 +146,8 @@ Grob::Grob (SCM basicprops,
       else if (ly_is_procedure (cb))
        dim_cache_[a].dimension_callback_ = cb;
       else if (cb == SCM_EOL
-              && ly_is_procedure (get_property ("print-function")))
+              && ly_is_procedure (ly_assoc_get (ly_symbol2scm ("stencil"),
+                                                property_callbacks_, SCM_BOOL_F)))
        dim_cache_[a].dimension_callback_ = stencil_extent_proc;
     }
 
@@ -213,39 +214,27 @@ Grob::get_stencil () const
     return 0;
 
   SCM stil = get_property ("stencil");
-  if (unsmob_stencil (stil))
-    return unsmob_stencil (stil);
-
-  stil = get_uncached_stencil ();
-  if (is_live ())
-    {
-      Grob *me = (Grob *) this;
-      me->set_property ("stencil", stil);
-    }
-
   return unsmob_stencil (stil);
 }
 
-SCM
-Grob::get_uncached_stencil () const
+Stencil
+Grob::get_print_stencil () const
 {
-  SCM proc = get_property ("print-function");
-
-  SCM stil = SCM_EOL;
-  if (ly_is_procedure (proc))
-    stil = scm_apply_0 (proc, scm_list_n (this->self_scm (), SCM_UNDEFINED));
+  SCM stil = get_property ("stencil");
 
+  Stencil retval;
   if (Stencil *m = unsmob_stencil (stil))
     {
+      retval = *m;
       if (to_boolean (get_property ("transparent")))
-       stil = Stencil (m->extent_box (), SCM_EOL).smobbed_copy ();
+       retval = Stencil (m->extent_box (), SCM_EOL);
       else
        {
          SCM expr = m->expr ();
          if (point_and_click_global)
            expr = scm_list_3 (ly_symbol2scm ("grob-cause"), self_scm (), expr);
 
-         stil = Stencil (m->extent_box (), expr).smobbed_copy ();
+         retval = Stencil (m->extent_box (), expr);
        }
 
       /* color support... see interpret_stencil_expression () for more... */
@@ -257,11 +246,12 @@ Grob::get_uncached_stencil () const
                                 color,
                                 m->expr ());
 
-         stil = Stencil (m->extent_box (), expr).smobbed_copy ();
+         retval = Stencil (m->extent_box (), expr);
        }
+
     }
 
-  return stil;
+  return retval;
 }
 
 /*
@@ -712,10 +702,12 @@ ADD_INTERFACE (Grob, "grob-interface",
               "Mutable properties are variables that are specific to one grob. Typically, "
               "lists of other objects, or results from computations are stored in"
               "mutable properties: every call to set-grob-property (or its C++ equivalent) "
-              "sets a mutable property. ",
+              "sets a mutable property. "
               "\n\n"
-              
-              "The properties @code{after-line-breaking} and @code{before-line-breaking} are unused dummies. "
+              "The properties @code{after-line-breaking} and @code{before-line-breaking} "
+              "are dummies that are not user-serviceable. "
+
+              ,
 
               /* properties */
               "X-extent "
index a5e8c62068762128a4023eee1d5c5c577f362282..21ad403a170c9fbecd0e9cf8545c97c4d2edbd71 100644 (file)
@@ -100,7 +100,7 @@ public:
   virtual void derived_mark () const;
 
   Stencil *get_stencil () const;
-  SCM get_uncached_stencil () const;
+  Stencil get_print_stencil () const;
 
   void suicide ();
   bool is_live () const;
index 34a302954fc58a9fa93116489c3d8688b00893c0..42d0193ad1f18844e2d44b88ef8656d68dda9073 100644 (file)
@@ -354,11 +354,12 @@ Multi_measure_rest::set_text_rods (SCM smob)
                              {li, rb},
                              {lb, rb}};
 
-  SCM st = me->get_uncached_stencil ();
-  Real len = unsmob_stencil (st)
-    ? unsmob_stencil (st)->extent (X_AXIS).length ()
+  Stencil *stil = me->get_stencil ();
+
+  /* FIXME uncached */
+  Real len = (stil && !stil->extent (X_AXIS).is_empty ())
+    ? stil->extent (X_AXIS).length ()
     : 0.0;
-  
 
   for (int i = 0; i < 4; i++)
     {
@@ -384,6 +385,8 @@ Multi_measure_rest::set_text_rods (SCM smob)
 
 ADD_INTERFACE (Multi_measure_rest, "multi-measure-rest-interface",
               "A rest that spans a whole number of measures.",
+
+              /* properties */
               "expand-limit "
               "measure-count "
               "hair-thickness "
index b2968cb38adb115c59f3dc3ebc0c76786b2131e9..dfabf0e84ee962b18aed4ff6768af17a25e2af3a 100644 (file)
@@ -711,7 +711,8 @@ Slur_score_state::enumerate_attachments (Drul_array<Real> end_ys) const
            {
              do
                {
-                 if (extremes_[d].slur_head_)
+                 if (extremes_[d].slur_head_
+                     && !extremes_[d].slur_head_extent_.is_empty ())
                    {
                      os[d][X_AXIS] = extremes_[d].slur_head_extent_.center ();
                      attach_to_stem[d] = false;
index 72dbe3dd0841cb139f04d9dc777e277f18948c75..d02c0b0e44dd1e1649ea5ca11e66fd1a92f73596 100644 (file)
@@ -64,11 +64,9 @@ Slur::height (SCM smob, SCM ax)
   Grob *me = unsmob_grob (smob);
   assert (a == Y_AXIS);
 
-  SCM mol = me->get_uncached_stencil ();
-  Interval ext;
-  if (Stencil *m = unsmob_stencil (mol))
-    ext = m->extent (a);
-  return ly_interval2scm (ext);
+  // FIXME uncached
+  Stencil *m = me->get_stencil ();
+  return m ? ly_interval2scm (m->extent (a)) : ly_interval2scm (Interval ());
 }
 
 /*
index 167c87a47482e493db681edd6d522f5dee691efd..e5571b1e42b850024a444a40917c5642c2f5604b 100644 (file)
@@ -32,7 +32,6 @@ Stem_tremolo::dim_callback (SCM e, SCM)
   return ly_interval2scm (Interval (-space, space));
 }
 
-/* ugh ?  --from Slur   */
 MAKE_SCHEME_CALLBACK (Stem_tremolo, height, 2);
 SCM
 Stem_tremolo::height (SCM smob, SCM ax)
@@ -41,12 +40,11 @@ Stem_tremolo::height (SCM smob, SCM ax)
   Grob *me = unsmob_grob (smob);
   assert (a == Y_AXIS);
 
-  SCM mol = me->get_uncached_stencil ();
 
-  if (Stencil *m = unsmob_stencil (mol))
-    return ly_interval2scm (m->extent (a));
-  else
-    return ly_interval2scm (Interval ());
+  /* TODO: fixme. uncached? */
+  return ly_interval2scm (me->get_stencil ()
+                         ? me->get_stencil ()->extent (a)
+                         : Interval());
 }
 
 Stencil
index 25f8e051c38bc2114ef6fb819e0ef11bfcca28b4..3f1bf40f333f84a4ccf05c512d49de4bfede2a2b 100644 (file)
@@ -507,11 +507,6 @@ Stem::calc_stem_end_position (SCM smob)
   return scm_from_double (pos);
 }
 
-/*
-  ugh.
-  When in a beam with tuplet brackets, brew_mol is called early,
-  caching a wrong value.
-*/
 MAKE_SCHEME_CALLBACK (Stem, height, 2);
 SCM
 Stem::height (SCM smob, SCM ax)
@@ -531,12 +526,9 @@ Stem::height (SCM smob, SCM ax)
     {
       beam->get_property ("positions");
     }
-  
-  SCM mol = me->get_uncached_stencil ();
-  Interval iv;
-  if (mol != SCM_EOL)
-    iv = unsmob_stencil (mol)->extent (a);
-  
+
+  /* FIXME uncached? */
+  Interval iv = me->get_stencil () ? me->get_stencil ()->extent (a) : Interval();
   if (beam)
     {
       if (dir == CENTER)
index ad5113a0fb6a447c9f3a55eae84729d06be0fe45..0ca8cfda14383e1aaa00eef2d42650d982a9dc25 100644 (file)
@@ -342,15 +342,16 @@ System::get_paper_system ()
     for (int j = all_elements_->size (); j--;)
       {
        Grob *g = all_elements_->grob (j);
-       Stencil *stil = g->get_stencil ();
+       Stencil st = g->get_print_stencil ();
 
        /* Skip empty stencils and grobs that are not in this layer.  */
-       if (!stil
+       if (st.expr() == SCM_EOL
            || robust_scm2int (g->get_property ("layer"), 1) != i)
          continue;
 
-       Offset o (g->relative_coordinate (this, X_AXIS),
-                 g->relative_coordinate (this, Y_AXIS));
+       Offset o;
+       for (int a = X_AXIS; a < NO_AXES; a++)
+         o[Axis (a)] = g->relative_coordinate (this, Axis (a));
 
        Offset extra = robust_scm2offset (g->get_property ("extra-offset"),
                                          Offset (0, 0))
@@ -359,7 +360,6 @@ System::get_paper_system ()
        /* Must copy the stencil, for we cannot change the stencil
           cached in G.  */
 
-       Stencil st = *stil;
        st.translate (o + extra);
 
        *tail = scm_cons (st.expr (), SCM_EOL);
index da8f7f53cff759a301d604645b12d7efe1513601..15913c841420bba1bf20c28a41fc50fa416bf9e5 100644 (file)
@@ -2582,3 +2582,18 @@ def conv (str):
 
 conversions.append (((2, 7, 12), conv,
                     '''outputProperty -> overrideProperty'''))
+
+def conv (str):
+       if re.search(r'(after-line-breaking-callback|before-line-breaking-callback|print-function)', str):
+               error_file.write ("""
+
+Conversion rules for 2.7.13 layout engine refactoring haven't been written yet.
+
+""")
+               
+               raise FatalConversionError ()
+       
+       return str
+
+conversions.append (((2, 7, 13), conv,
+                    '''layout engine refactoring. [FIXME] '''))
index 73cc5ce6874d7620fcb94ccec80634c73b7dc2f3..46c531d868a727d10f4ff8ef126a20219d9c00a2 100644 (file)
   `(
     (Accidental
      . (
-       (print-function . ,Accidental_interface::print)
        (avoid-slur . inside)
        (cautionary-style . parentheses)
-       (callbacks ((after-line-breaking . ,Accidental_interface::after_line_breaking)))
+       (callbacks . ((stencil . ,Accidental_interface::print)
+                     (after-line-breaking . ,Accidental_interface::after_line_breaking)))
        
        (meta . ((class . Item)
                 (interfaces . (accidental-interface
                                font-interface))))))
-
+    
     (AccidentalSuggestion
-     . ((print-function . ,Accidental_interface::print)
+     . (
+
+       (callbacks . ((stencil . ,Accidental_interface::print)))
        (X-offset-callbacks . (,Self_alignment_interface::centered_on_parent
                               ,Self_alignment_interface::aligned_on_self))
        (self-alignment-X . ,CENTER)
@@ -78,7 +80,7 @@
 
     (AmbitusLine
      . (
-       (print-function . ,Ambitus::print)
+       (callbacks . (  (stencil . ,Ambitus::print)))
        (join-heads . #t)
        (thickness . 2)
        (X-offset-callbacks . (,Self_alignment_interface::centered_on_parent))
                                font-interface))))))
     (AmbitusAccidental
      . (
-       (print-function . ,Accidental_interface::print)
        (font-family . music)
        (padding . 0.5)
        (X-offset-callbacks . (,Side_position_interface::aligned_side))
        (direction . -1)
        (cautionary-style . parentheses)
-       (callbacks . ((after-line-breaking . ,Accidental_interface::after_line_breaking)
+       (callbacks . ((stencil . ,Accidental_interface::print)
+                     (after-line-breaking . ,Accidental_interface::after_line_breaking)
                      ))
        (meta . ((class . Item)
                 (interfaces . (item-interface
     (AmbitusNoteHead
      . (
        (duration-log . 2)
-       (print-function . ,Note_head::print)
+       (callbacks . (  (stencil . ,Note_head::print)))
        (glyph-name-procedure . ,find-notehead-symbol)
        (Y-offset-callbacks . (,Staff_symbol_referencer::callback))
        (meta . ((class . Item)
     (Arpeggio
      . (
        (X-extent-callback . ,Arpeggio::width_callback)
-       (print-function . ,Arpeggio::print)
+       (callbacks . (  (stencil . ,Arpeggio::print)))
        (Y-offset-callbacks . (,Staff_symbol_referencer::callback))
        (X-offset-callbacks . (,Side_position_interface::aligned_side))
        (direction . -1)
        (break-glyph-function . ,default-break-barline)
        (layer . 0)
        (bar-size-procedure . ,Bar_line::get_staff_bar_size)
-       (print-function . ,Bar_line::print)
        (break-visibility . ,all-visible)
        (breakable . #t)
-       (callbacks . ((before-line-breaking . ,Bar_line::before_line_breaking)))
+       (callbacks . ((stencil . ,Bar_line::print)
+                     (before-line-breaking . ,Bar_line::before_line_breaking)))
        (space-alist . (
                        (time-signature . (extra-space . 0.75))
                        (custos . (minimum-space . 2.0))
 
     (BarNumber
      . (
-       (print-function . ,Text_interface::print)
+       (callbacks . ((stencil . ,Text_interface::print)))
        (breakable . #t)
        (break-visibility . ,begin-of-line-visible)
        (padding . 1.0)
 
     (BassFigure
      . (
-       (print-function . ,Text_interface::print)
+       (callbacks . ((stencil . ,Text_interface::print)))
        (Y-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
        (direction . 1)
        (font-family . number)
 
     (NewBassFigure
      . (
-       (print-function . ,Text_interface::print)
+       (callbacks . (  (stencil . ,Text_interface::print)))
        (meta . ((class . Item)
                 (interfaces . (text-interface
                                rhythmic-grob-interface
                                bass-figure-interface
                                font-interface))))))
     (BassFigureBracket
-     . ((print-function . ,Enclosing_bracket::print)
+     . ((callbacks . ((stencil . ,Enclosing_bracket::print)))
        (edge-height . (0.2 . 0.2))
        (meta . ((class . Item)
                 (interfaces . (enclosing-bracket-interface)) ))
        ))
     (BassFigureContinuation
      . (
-       (print-function . ,Figured_bass_continuation::print)
+       (callbacks . (  (stencil . ,Figured_bass_continuation::print)))
        (Y-offset-callbacks . (,Figured_bass_continuation::center_on_figures))
        (meta . ((class . Spanner)
                 (interfaces . (figured-bass-continuation-interface))
      . (
        ;; todo: clean this up a bit: the list is getting
        ;; rather long.
-       (print-function . ,Beam::print)
        (gap . 0.8)
        (position-callbacks . (,Beam::least_squares
                               ,Beam::check_concave
                               ,Beam::quanting))
        (callbacks . ((positions . ,Beam::calc_positions)
                      (direction . ,Beam::calc_direction)
+                     (stencil . ,Beam::print)
                      ))
 
        ;; TODO: should be in SLT.
                        (clef . (minimum-space . 2.0))
                        (first-note . (fixed-space . 1.0)) ;huh?
                        (right-edge . (extra-space . 0.1))))
-       (print-function . ,Text_interface::print)
+       (callbacks . ((stencil . ,Text_interface::print)))
        (text . ,(make-musicglyph-markup "scripts.rcomma"))
        (Y-offset-callbacks . (,Breathing_sign::offset_callback))
        (break-visibility . ,begin-of-line-invisible)
 
     (Clef
      . (
-       (print-function . ,Clef::print)
-       (callbacks ((before-line-breaking . ,Clef::before_line_breaking)))
+       (callbacks . ((stencil . ,Clef::print)
+                     (before-line-breaking . ,Clef::before_line_breaking)
+                     ))
        (breakable . #t)
        (font-family . music)
        (break-align-symbol . clef)
 
     (ClusterSpannerBeacon
      . (
-       (print-function . #f)
        (Y-extent-callback . ,Cluster_beacon::height)
        (meta . ((class . Item)
                 (interfaces . (cluster-beacon-interface))))))
 
     (ClusterSpanner
      . (
-       (print-function . ,Cluster::print)
+       (callbacks . ((stencil . ,Cluster::print)))
        (spacing-procedure . ,Spanner::set_spacing_rods)
        (minimum-length . 0.0)
        (padding . 0.25)
 
     (ChordName
      . (
-       (print-function . ,Text_interface::print)
+       (callbacks . ((stencil . ,Text_interface::print)))
        (callbacks . ((after-line-breaking . ,Chord_name::after_line_breaking)
                      ))
        (word-space . 0.0)
 
     (CombineTextScript
      . (
-       (print-function . ,Text_interface::print)
+       (callbacks . ((stencil . ,Text_interface::print)))
        (no-spacing-rods . #t)
        (Y-offset-callbacks . (,Side_position_interface::aligned_side))
        (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
      . (
        (break-align-symbol . custos)
        (breakable . #t)
-       (print-function . ,Custos::print)
+       (callbacks . ((stencil . ,Custos::print)))
        (break-visibility . ,end-of-line-visible)
        (style . vaticana)
        (neutral-direction . -1)
        (axes . (0))
        (direction . ,RIGHT)
        (callbacks . ((positioning-done . ,Dot_column::calc_positioning_done) 
-                      ))
+                     ))
        (X-extent-callback . ,Axis_group_interface::group_extent_callback)
        (X-offset-callbacks . (,Dot_column::side_position))
        (meta . ((class . Item)
 
     (Dots
      . (
-       (print-function . ,Dots::print)
+       (callbacks . ((stencil . ,Dots::print)))
        (dot-count . 1)
        (meta . ((class . Item)
                 (interfaces . (font-interface
 
     (DoublePercentRepeat
      . (
-       (print-function . ,Percent_repeat_item_interface::double_percent)
+       (callbacks . ((stencil . ,Percent_repeat_item_interface::double_percent)))
        (breakable . #t)
        (slope . 1.0)
        (font-encoding . fetaMusic)
                                percent-repeat-interface))))))
 
     (DoublePercentRepeatCounter
-     . ((print-function . ,Text_interface::print)
+     . (
+       (callbacks . ((stencil . ,Text_interface::print)))
        (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self
                               ,Self_alignment_interface::centered_on_other_axis_parent))
        (Y-offset-callbacks . (,Side_position_interface::aligned_side))
 
     (DynamicText
      . (
-       (print-function . ,Text_interface::print)
+       
        ;; todo.
-       (callbacks . ((before-line-breaking . ,Script_interface::before_line_breaking)))
+       (callbacks . ((stencil . ,Text_interface::print)
+                     (before-line-breaking . ,Script_interface::before_line_breaking)))
        (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
        (self-alignment-X . 0)
        (Y-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
                                script-interface))))))
 
     (DynamicTextSpanner
-     . ((print-function . ,Dynamic_text_spanner::print)
-
+     . (
+       (callbacks . ((stencil . ,Dynamic_text_spanner::print)))
        ;; rather ugh with NCSB
        ;; (font-series . bold)
        (font-shape . italic)
 
     (Fingering
      . (
-       (print-function . ,Text_interface::print)
 
        ;; sync with TextScript (?)
 
        (self-alignment-X . 0)
        (self-alignment-Y . 0)
        (script-priority . 100)
-       (callbacks . ((before-line-breaking . ,Script_interface::before_line_breaking)))
+       (callbacks . ((stencil . ,Text_interface::print)
+                     (before-line-breaking . ,Script_interface::before_line_breaking)))
        (font-encoding . fetaNumber)
        (font-size . -5)                ; don't overlap when next to heads.
        (meta . ((class . Item)
        (breakable . #t)
        (X-extent-callback . #f)
        (Y-extent-callback . #f)
-       (callbacks ((after-line-breaking . ,Line_spanner::after_line_breaking)
-                   ))
-       (print-function . ,Line_spanner::print)
+       (callbacks . ((stencil . ,Line_spanner::print)
+                     (after-line-breaking . ,Line_spanner::after_line_breaking)
+                     ))
+       
        (meta . ((class . Spanner)
                 (interfaces . (line-interface
                                line-spanner-interface))))))
 
     (GridLine
      . (
-       (print-function . ,Grid_line_interface::print)
+       (callbacks . (stencil . ,Grid_line_interface::print))
        (X-extent-callback  . ,Grid_line_interface::width_callback)
        (self-alignment-X . ,CENTER)
        (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self
 
     (Hairpin
      . (
-       (print-function . ,Hairpin::print)
-       (callbacks . ((after-line-breaking . ,Hairpin::after_line_breaking)))
+       
+       (callbacks . ((stencil . ,Hairpin::print)
+                     (after-line-breaking . ,Hairpin::after_line_breaking)))
        (thickness . 1.0)
        (height . 0.6666)
        (spacing-procedure . ,Spanner::set_spacing_rods)
     (HorizontalBracket
      . (
        (thickness . 1.0)
-       (print-function . ,Horizontal_bracket::print)
+       (callbacks . ((stencil . ,Horizontal_bracket::print)))
        (Y-offset-callbacks . (,Side_position_interface::aligned_side))
        (padding . 0.2)
        (staff-padding . 0.2)
                        (left-edge . (extra-space . 1.0))))
 
        (self-alignment-Y . 0)
-       (print-function . ,Text_interface::print)
+       (callbacks . ((stencil . ,Text_interface::print)))
        (break-align-symbol . instrument-name)
        (break-visibility . ,begin-of-line-visible)
        (baseline-skip . 2)
 
     (KeyCancellation
      . (
-       (print-function . ,Key_signature_interface::print)
+       (callbacks . ((stencil . ,Key_signature_interface::print)))
        (space-alist . (
                        (time-signature . (extra-space . 1.25))
                        (staff-bar . (extra-space . 0.6))
                                break-aligned-interface))))))
     (KeySignature
      . (
-       (print-function . ,Key_signature_interface::print)
+       (callbacks . ((stencil . ,Key_signature_interface::print)))
        (space-alist . (
                        (time-signature . (extra-space . 1.25))
                        (staff-bar . (extra-space . 1.1))
                                break-aligned-interface))))))
     (LaissezVibrerTie
      . (
-       (print-function  . ,Tie::print)
-       (callbacks . ((control-points . ,Laissez_vibrer_tie::calc_control_points)
+       (callbacks . ((stencil  . ,Tie::print)
+                     (control-points . ,Laissez_vibrer_tie::calc_control_points)
                      (direction . ,Laissez_vibrer_tie::calc_direction)
                      ))
        (details . ((ratio . 0.333)
     
     (LedgerLineSpanner
      . (
-       (print-function . ,Ledger_line_spanner::print)
+       (callbacks . ((stencil . ,Ledger_line_spanner::print)))
        (X-extent-callback . #f)
        (Y-extent-callback . #f)
        (minimum-length-fraction . 0.25)
        (length-fraction . 0.25)
        (spacing-procedure . ,Ledger_line_spanner::set_spacing_rods)
-       (print-function . ,Ledger_line_spanner::print)
        (layer . 0)
        (meta . ((class . Spanner)
                 (interfaces . (ledger-line-interface))))))
        ;; a tuplet bracket.
        (callbacks . ((direction  . ,Tuplet_bracket::calc_direction)
                      (positions . ,Tuplet_bracket::calc_positions)
+                     (stencil . ,Tuplet_bracket::print)
                      ))
        (direction . 1)
        (gap . 0.0)
        (thickness . 1.6)
        (edge-height . (0.7 . 0.7))
        (shorten-pair . (-0.2 . -0.2))
-       (print-function . ,Tuplet_bracket::print)
        (meta . ((class . Spanner)
                 (interfaces . (tuplet-bracket-interface
                                line-interface))))))
        (minimum-length . 0.3)
        (padding . 0.07)
                                        ;       (spacing-procedure . ,Hyphen_spanner::set_spacing_rods)
-       (print-function . ,Hyphen_spanner::print)
+       (callbacks . ((stencil . ,Hyphen_spanner::print)))
        (Y-extent . (0 . 0))
        (meta . ((class . Spanner)
                 (interfaces . (lyric-interface
 
     (LyricExtender
      . (
-       (print-function . ,Lyric_extender::print)
+       (callbacks . ((stencil . ,Lyric_extender::print)))
        (thickness . 0.8) ; linethickness
        (minimum-length . 1.5)
        (Y-extent . (0 . 0))
                                lyric-extender-interface))))))
 
     (LyricText
-     . ((print-function . ,Text_interface::print)
+     . ((callbacks . ((stencil . ,Text_interface::print)))
        (X-offset-callbacks . (,Self_alignment_interface::aligned_on_parent))
        (self-alignment-X . 0)
        (word-space . 0.6)
        (thickness . 1.4)
        (flexa-width . 2.0)
        (ligature-primitive-callback . ,Mensural_ligature::brew_ligature_primitive)
-       (print-function . ,Mensural_ligature::print)
+       (callbacks . ((stencil . ,Mensural_ligature::print)))
        (meta . ((class . Spanner)
                 (interfaces . (mensural-ligature-interface
                                font-interface))))))
 
     (MetronomeMark
      . (
-       (print-function . ,Text_interface::print)
+       (callbacks . ((stencil . ,Text_interface::print)))
        (Y-offset-callbacks . (,Side_position_interface::aligned_side))
        (direction . 1)
        (padding . 0.8)
     (MeasureGrouping
      . (
        (Y-offset-callbacks . (,Side_position_interface::aligned_side))
-       (print-function . ,Measure_grouping::print)
+       (callbacks . (stencil . ,Measure_grouping::print))
        (padding . 2)
        (direction . 1)
        (thickness . 1)
                                measure-grouping-interface))))))
     (MultiMeasureRest
      . (
-       (print-function . ,Multi_measure_rest::print)
+       (callbacks . ((stencil . ,Multi_measure_rest::print)))
        (Y-offset-callbacks . (,Staff_symbol_referencer::callback))
        (staff-position . 0)
        (expand-limit . 10)
 
     (MultiMeasureRestNumber
      . (
-       (print-function . ,Text_interface::print)
+       (callbacks . ((stencil . ,Text_interface::print)))
        (spacing-procedure . ,Multi_measure_rest::set_spacing_rods)
        (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self
                               ,Self_alignment_interface::centered_on_other_axis_parent))
     
     (MultiMeasureRestText
      . (
-       (print-function . ,Text_interface::print)
+       (callbacks . ((stencil . ,Text_interface::print)))
        (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self
                               ,Self_alignment_interface::centered_on_other_axis_parent))
        (Y-offset-callbacks . (,Side_position_interface::aligned_side))
 
     (NoteHead
      . (
-       (print-function . ,Note_head::print)
+       (callbacks . ((stencil . ,Note_head::print)))
        (ligature-primitive-callback . ,Note_head::print)
        (glyph-name-procedure . ,find-notehead-symbol)
        (Y-offset-callbacks . (,Staff_symbol_referencer::callback))
 
     (NoteName
      . (
-       (print-function . ,Text_interface::print)
+       (callbacks . ((stencil . ,Text_interface::print)))
        (meta . ((class . Item)
                 (interfaces . (note-name-interface
                                text-interface
        (X-offset-callbacks . (,Self_alignment_interface::centered_on_parent
                               ,Self_alignment_interface::aligned_on_self))
        (Y-offset-callbacks . (,Side_position_interface::aligned_side))
-       (print-function . ,Text_interface::print)
+       (callbacks . ((stencil . ,Text_interface::print)))
 
        ;; no Y dimensions, because of lyrics under tenor clef.
        (Y-extent . (0 . 0))
     (OttavaBracket
      . (
        (Y-offset-callbacks . (,Side_position_interface::aligned_side))
-       (print-function . ,Ottava_bracket::print)
+       (callbacks . ((stencil . ,Ottava_bracket::print)))
        (font-shape . italic)
        (shorten-pair . (0.0 . -0.6))
        (staff-padding . 1.0)
     (PaperColumn
      . (
        (axes . (0))
-       (callbacks ((before-line-breaking . ,Paper_column::before_line_breaking)))
+       (callbacks . ((before-line-breaking . ,Paper_column::before_line_breaking)
+                     ;; (stencil . ,Paper_column::print)
+                     ))
        (X-extent-callback . ,Axis_group_interface::group_extent_callback)
 
        ;; debugging
-;;                     (print-function . ,Paper_column::print) (font-size . -6) (font-name . "sans") (Y-extent-callback . #f)
+       ;;                       (font-size . -6) (font-name . "sans") (Y-extent-callback . #f)
        (meta . ((class . Paper_column)
                 (interfaces . (paper-column-interface
                                axis-group-interface
      . ((slur-details . ,default-slur-details)
        (callbacks . ((control-points . ,Slur::calc_control_points)
                      (direction . ,Slur::calc_direction)
-                      ))
-       (print-function . ,Slur::print)
+                     (stencil . ,Slur::print)                
+                     ))
+       
        (thickness . 1.1)
        (spacing-procedure . ,Spanner::set_spacing_rods)
        (minimum-length . 1.5)
      . (
        (axes . (0))
        (X-extent-callback . ,Axis_group_interface::group_extent_callback)
-       (callbacks . ((before-line-breaking . ,Paper_column::before_line_breaking)))
+       (callbacks . ((before-line-breaking . ,Paper_column::before_line_breaking)
+                     ;;                      (stencil . ,Paper_column::print)
+                     ))
        (breakable . #t)
 
        ;; debugging stuff: print column number.
-;;             (print-function . ,Paper_column::print) (font-size . -6) (font-name . "sans")   (Y-extent-callback . #f)
+       ;;               (font-size . -6) (font-name . "sans")  (Y-extent-callback . #f)
 
        (meta . ((class . Paper_column)
                 (interfaces . (paper-column-interface
     (PercentRepeat
      . (
        (spacing-procedure . ,Multi_measure_rest::set_spacing_rods)
-       (print-function . ,Multi_measure_rest::percent)
+       (callbacks . ((stencil . ,Multi_measure_rest::percent)))
        (slope . 1.0)
        (thickness . 0.48)
        (font-encoding . fetaMusic)
                                font-interface
                                percent-repeat-interface))))))
     (PercentRepeatCounter
-     . ((print-function . ,Text_interface::print)
+     . ((callbacks . ((stencil . ,Text_interface::print)))
        (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self
                               ,Self_alignment_interface::centered_on_other_axis_parent))
        (Y-offset-callbacks . (,Side_position_interface::aligned_side))
     ;; an example of a text spanner
     (PianoPedalBracket
      . (
-       (print-function . ,Piano_pedal_bracket::print)
+       (callbacks . ((stencil . ,Piano_pedal_bracket::print)))
        (style . line)
        (bound-padding . 1.0)
        (direction . -1)
 
     (RehearsalMark
      . (
-       (print-function . ,Text_interface::print)
+       (callbacks . ((stencil . ,Text_interface::print)))
        (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
        (Y-offset-callbacks . (,Side_position_interface::aligned_side))
        (callbacks . ((after-line-breaking . ,shift-right-at-line-begin)))
 
     (RepeatSlash
      . (
-       (print-function . ,Percent_repeat_item_interface::beat_slash)
+       (callbacks . ((stencil . ,Percent_repeat_item_interface::beat_slash)))
        (thickness . 0.48)
        (slope . 1.7)
        (meta . ((class . Item)
      . (
        (X-extent-callback . ,Rest::extent_callback)
        (Y-extent-callback . ,Rest::extent_callback)
-       (print-function . ,Rest::print)
+       (callbacks . ((stencil . ,Rest::print)))
        (Y-offset-callbacks . (
                               ,Staff_symbol_referencer::callback
                               ,Rest::polyphonic_offset_callback
     (Script
      . (
        ;; don't set direction here: it breaks staccato.
-       (print-function . ,Script_interface::print)
 
        ;; This value is sensitive: if too large, staccato dots will move a
        ;; space a away.
        (staff-padding . 0.25)
        ;; (script-priority . 0) priorities for scripts, see script.scm
        (X-offset-callbacks . (,Self_alignment_interface::centered_on_parent))
-       (callbacks . ((before-line-breaking . ,Script_interface::before_line_breaking)))
+       (callbacks . ((stencil . ,Script_interface::print)
+                     (before-line-breaking . ,Script_interface::before_line_breaking)))
        (font-encoding . fetaMusic)
        (meta . ((class . Item)
                 (interfaces . (script-interface
      . ((slur-details . ,default-slur-details)
        (callbacks . ((control-points . ,Slur::calc_control_points)
                      (direction . ,Slur::calc_direction)
-                      ))
-       (print-function . ,Slur::print)
+                     (stencil . ,Slur::print)
+                     ))
        (thickness . 1.0)
        (spacing-procedure . ,Spanner::set_spacing_rods)
        (minimum-length . 1.5)
      . (
        (break-align-symbol . staff-bar)
        (bar-size-procedure . ,Span_bar::get_bar_size)
-       (print-function . ,Span_bar::print)
        (X-extent-callback . ,Span_bar::width_callback)
        (Y-extent-callback . ())
        (layer . 0)
        (breakable . #t)
-       (callbacks . ((before-line-breaking . ,Span_bar::before_line_breaking)))
+       (callbacks . ((stencil . ,Span_bar::print)
+                     (before-line-breaking . ,Span_bar::before_line_breaking)))
        ;; ugh duplication!
 
        ;;
                                bar-line-interface))))))
 
     (StanzaNumber
-     . ((print-function . ,Text_interface::print)
+     . ((callbacks . ((stencil . ,Text_interface::print)))
        (font-series . bold)
        (padding . 1.0)
        (X-offset-callbacks . (,Side_position_interface::aligned_side))
 
     (StringNumber
      . (
-       (print-function . ,print-circled-text-callback)
+       (callbacks . ((stencil . ,print-circled-text-callback)))
        (padding . 0.5)
        (staff-padding . 0.5)
        (self-alignment-X . 0)
      . (
        (breakable . #t)
        (stem-spacing-correction . 0.4)
-
        (meta . ((class . Item)
                 (interfaces . (spacing-interface
                                staff-spacing-interface))))))
 
     (SostenutoPedal
      . (
-       (print-function . ,Text_interface::print)
+       (callbacks . ((stencil . ,Text_interface::print)))
        (direction . 1)
        (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
        (no-spacing-rods . #t)
 
     (StaffSymbol
      . (
-       (print-function . ,Staff_symbol::print)
+       (callbacks . ((stencil . ,Staff_symbol::print)))
        (line-count . 5)
        (ledger-line-thickness . (1.0 . 0.1))
        (layer . 0)
                      (stem-end-position . ,Stem::calc_stem_end_position)
                      (stem-info . ,Stem::calc_stem_info)
                      (positioning-done . ,Stem::calc_positioning_done)
+                     (stencil . ,Stem::print)
                      ))
-       (print-function . ,Stem::print)
        (thickness . 1.3)
 
        ;; 3.5 (or 3 measured from note head) is standard length
 
     (StemTremolo
      . (
-       (print-function . ,Stem_tremolo::print)
+       (callbacks . ((stencil . ,Stem_tremolo::print)))
        (Y-extent-callback . ,Stem_tremolo::height)
        (X-extent-callback . #f)
 
     (SustainPedal
      . (
        (no-spacing-rods . #t)
-       (print-function . ,Sustain_pedal::print)
+       (callbacks . ((stencil . ,Sustain_pedal::print)))
        (self-alignment-X . 0)
        (direction . 1)
        (padding . 0.0)  ;; padding relative to SustainPedalLineSpanner
     (SystemStartBrace
      . (
        (glyph . "brace")
-       (print-function . ,System_start_delimiter::print)
+       (callbacks . ((stencil . ,System_start_delimiter::print)))
        (collapse-height . 5.0)
        (font-encoding . fetaBraces)
        (Y-extent-callback . #f)
      . (
        (Y-extent-callback . #f)
        (X-offset-callbacks . (,(lambda (g a) -0.8)))
-       (print-function . ,System_start_delimiter::print)
+       (callbacks . ((stencil . ,System_start_delimiter::print)))
        (glyph . "bracket")
        (collapse-height . 5.0)
        (thickness . 0.45)
     (SystemStartBar
      . (
        (Y-extent-callback . #f)
-       (print-function . ,System_start_delimiter::print)
        (glyph . "bar-line")
        (thickness . 1.6)
-       (callbacks . ((after-line-breaking . ,System_start_delimiter::after_line_breaking)))
+       (callbacks . ((stencil . ,System_start_delimiter::print)
+                     (after-line-breaking . ,System_start_delimiter::after_line_breaking)))
        
        (meta . ((class . Spanner)
                 (interfaces . (system-start-delimiter-interface))))))
 
     (TabNoteHead
      . (
-       (print-function . ,Text_interface::print)
+       (callbacks . ((stencil . ,Text_interface::print)))
        (Y-offset-callbacks . (,Staff_symbol_referencer::callback))
        (font-size . -2)
        (stem-attachment-function . ,tablature-stem-attachment-function)
 
     (TextScript
      . (
-       (print-function . ,Text_interface::print)
        (no-spacing-rods . #t)
        (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
        (direction . -1)
        ;; sync with Fingering ?
        (padding . 0.5)
        (staff-padding . 0.5)
-       (callbacks . ((before-line-breaking . ,Script_interface::before_line_breaking)))
+       (callbacks . ((stencil . ,Text_interface::print)
+                     (before-line-breaking . ,Script_interface::before_line_breaking)))
        (avoid-slur . around)
        (slur-padding . 0.5)
        (script-priority . 200)
 
     (TextSpanner
      . (
-       (print-function . ,Text_spanner::print)
+       (callbacks .((stencil . ,Text_spanner::print)))
        (font-shape . italic)
        (style . dashed-line)
        (staff-padding . 0.8)
                                font-interface))))))
 
     (Tie
-     . ((print-function . ,Tie::print)
+     . (
        (callbacks . ((control-points . ,Tie::calc_control_points)
                      (direction . ,Tie::calc_direction)
+                     (stencil . ,Tie::print)
                      ))
        (details . ((ratio . 0.333)
                    (height-limit . 1.0)
 
     (TimeSignature
      . (
-       (print-function . ,Time_signature::print)
+       (callbacks . ((stencil . ,Time_signature::print)))
        (break-align-symbol . time-signature)
        (break-visibility . ,all-visible)
        (space-alist . (
 
     (TrillSpanner
      . (
-       (print-function . ,Dynamic_text_spanner::print)
+       (callbacks . ((stencil . ,Dynamic_text_spanner::print)))
        (edge-text . ,(cons (make-musicglyph-markup "scripts.trill")
                            ""))
        (style . trill)
        (padding . 0.2)
        (direction . ,LEFT)
        (font-size . -4)
-       (print-function . ,Accidental_interface::print)
+       (callbacks . ((stencil . ,Accidental_interface::print)))
        (meta . ((class . Item)
                 (interfaces . (item-interface
                                accidental-interface
      . ((X-offset-callbacks . (,Side_position_interface::aligned_side))
        (axes . (,X))
        (font-size . -4)
-       (print-function . ,parenthesize-elements)
+       (callbacks . ((stencil . ,parenthesize-elements)))
        (direction . ,RIGHT)
        (padding . 0.3)
        (meta . ((class . Item)
                                axis-group-interface))))))
 
     (TrillPitchHead
-     . ((print-function . ,Note_head::print)
+     . ((callbacks . ((stencil . ,Note_head::print)))
        (duration-log . 2)
        (Y-offset-callbacks . (,Staff_symbol_referencer::callback))
        (font-size . -4)
        (shorten-pair . (-0.2 . -0.2))
        (callbacks . ((direction  . ,Tuplet_bracket::calc_direction)
                      (positions . ,Tuplet_bracket::calc_positions)
+                     (stencil . ,Tuplet_bracket::print)
                      ))
-       (print-function . ,Tuplet_bracket::print)
        (font-shape . italic)
 
        (font-size . -2)
 
     (UnaCordaPedal
      . (
-       (print-function . ,Text_interface::print)
+       (callbacks . ((stencil . ,Text_interface::print)))
        (font-shape . italic)
        (no-spacing-rods . #t)
        (self-alignment-X . 0)
        (thickness . 0.6)
        (flexa-width . 2.0)
        (ligature-primitive-callback . ,Vaticana_ligature::brew_ligature_primitive)
-       (print-function . ,Vaticana_ligature::print)
+       (callbacks . ((stencil . ,Vaticana_ligature::print)))
        (meta . ((class . Spanner)
                 (interfaces . (vaticana-ligature-interface
                                font-interface))))))
        (direction . 0)
        (space-alist . ((left-edge . (extra-space . 1.0))))
        (break-align-symbol . instrument-name)
-       (print-function . ,Text_interface::print)
+       (callbacks . ((stencil . ,Text_interface::print)))
        (break-align-symbol . clef)
        (break-visibility . ,begin-of-line-visible)
        (baseline-skip . 2)
 
     (VoltaBracket
      . (
-       (print-function . ,Volta_bracket_interface::print)
-       (callbacks . ((after-line-breaking . ,Volta_bracket_interface::after_line_breaking)))
+       (callbacks . ((stencil . ,Volta_bracket_interface::print)
+                     (after-line-breaking . ,Volta_bracket_interface::after_line_breaking)))
        (direction . ,UP)
        (padding . 1)
        (font-encoding . fetaNumber)
                                side-position-interface
                                font-interface))))))
 
+    
     (VoiceFollower
      . (
        (style . line)
        (breakable . #t)
        (X-extent-callback . #f)
        (Y-extent-callback . #f)
-       (print-function . ,Line_spanner::print)
-       (callbacks ((after-line-breaking . ,Line_spanner::after_line_breaking)))
+       
+       (callbacks . ((stencil . ,Line_spanner::print)
+                     (after-line-breaking . ,Line_spanner::after_line_breaking)))
        (meta . ((class . Spanner)
                 (interfaces . (line-spanner-interface
                                line-interface))))))))