]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/system.cc (uniquify_list): bugfix. This fixes spuriously
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 21 Mar 2004 00:01:52 +0000 (00:01 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 21 Mar 2004 00:01:52 +0000 (00:01 +0000)
translated stencils in the output.

* lily/paper-outputter.cc (output_line): don't add Stencil::origin.

ChangeLog
lily/include/stencil.hh
lily/paper-outputter.cc
lily/stencil-scheme.cc
lily/system.cc

index 9f45dbb2b579b2878ee8306172306c20b2f7ace9..da4dee423b52df0f77fd025d493d0cc8769144eb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2004-03-21  Han-Wen Nienhuys   <hanwen@xs4all.nl>
+
+       * lily/system.cc (uniquify_list): bugfix. This fixes spuriously
+       translated stencils in the output.
+
+       * lily/paper-outputter.cc (output_line): don't add Stencil::origin.
+
 2004-03-20  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
        * lily/tie-performer.cc (acknowledge_audio_element): bugfix: use
index 41f495e9982c5935f08c278a694533e999a3fda5..0af30a3d634b2566e69918a2d8bd970da4bd20c0 100644 (file)
@@ -43,6 +43,11 @@ class Stencil
 {
   friend SCM ly_stencil_set_extent_x (SCM, SCM, SCM);
 
+  /*
+    This provides the reference point of the symbol, for example with
+    characters, it is on the base line of the character. Usually,
+    ORIGIN is inside DIM_
+   */
   Offset origin_;
   Box dim_;
   SCM expr_;
index dff731a0ecef8438dcdf3b5c60a4c60464a0d25d..f3ff1e18986a51052839de07fb87bed1ac468397 100644 (file)
@@ -189,7 +189,7 @@ Paper_outputter::output_line (SCM line, Offset *origin, bool is_last)
     {
       Stencil *stil = unsmob_stencil (ly_car (s));
       if (stil)
-       output_expr (stil->get_expr (), stil->origin ());
+       output_expr (stil->get_expr (), Offset (0,0));
       /* Only if !PAGE_LAYOUT */
       else if (ly_caar (s) == ly_symbol2scm ("between-system-string"))
        between = ly_cdar (s);
index 0f859d822758644aee75b14486685bfd3c789e8e..79ab518636e0b29bf2e4d2cc8c70ad35a8e95f8e 100644 (file)
@@ -25,7 +25,8 @@ LY_DEFINE (ly_stencil_set_extent_x, "ly:stencil-set-extent!",
   Stencil *s = unsmob_stencil (stil);
   SCM_ASSERT_TYPE (s, stil, SCM_ARG1, __FUNCTION__, "stencil");
   SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG2, __FUNCTION__, "axis");
-  SCM_ASSERT_TYPE (is_number_pair (np), np, SCM_ARG3, __FUNCTION__, "number pair");
+  SCM_ASSERT_TYPE (is_number_pair (np), np, SCM_ARG3, __FUNCTION__,
+                  "number pair");
 
   Interval iv = ly_scm2interval (np);
   s->dim_[Axis (gh_scm2int (axis))] = iv;
index 350834f79ed60f7a58acf6af7baede85caf149f2..f0633da0c3a8fd4ba3967d95cd0e87b1e4baa30d 100644 (file)
@@ -73,26 +73,25 @@ uniquify_list (SCM l)
   int len = scm_ilength (l);
   SCM  * arr = new SCM[len];
   int k = 0;
-  for (SCM s =; SCM_NNULLP (s); s = SCM_CDR (s))
+  for (SCM s = l; SCM_NNULLP (s); s = SCM_CDR (s))
     arr[k++] = SCM_CAR (s);
 
   assert (k == len);
   qsort (arr, len, sizeof (SCM), &scm_default_compare);
 
   k = 0;
-  SCM s =l;
+  SCM *tail = &l;
+  
   for (int i = 0; i < len ; i++)
     {
       if (i && arr[i] == arr[i-1])
        continue;
 
-      SCM_SETCAR (s, arr[i]);
-
-      if (i < len - 1)
-       s = SCM_CDR (s);
+      SCM_SETCAR (*tail, arr[i]);
+      tail = SCM_CDRLOC(*tail);
     }
 
-  SCM_SETCDR (s, SCM_EOL);
+  *tail = SCM_EOL;
   delete[] arr;
   
   return l; 
@@ -402,8 +401,10 @@ System::get_line ()
      Start with layer 3, since  scm_cons prepends to list.
      
   */
+  SCM all = get_property ("all-elements");
+  
   for (int i = LAYER_COUNT; i--;)
-    for (SCM s = get_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s))
+    for (SCM s = all; gh_pair_p (s); s = ly_cdr (s))
       {
        Grob *g = unsmob_grob (ly_car (s));
        Stencil *stil = g->get_stencil ();
@@ -419,10 +420,14 @@ System::get_line ()
        Offset extra = robust_scm2offset (g->get_property ("extra-offset"),
                                          Offset (0, 0))
          * Staff_symbol_referencer::staff_space (g);
-       
-       /* FIXME: 0.5 */
-       stil->translate ((o + extra) * 0.5);
-       stencils = scm_cons (stil->smobbed_copy (), stencils);
+
+       /*
+         must copy the stencil, for we cannot change the stencil
+         cached in G.
+        */
+       SCM my_stencil = stil->smobbed_copy ();
+       unsmob_stencil (my_stencil)->translate (o + extra);
+       stencils = scm_cons (my_stencil, stencils);
       }
 
   if (output_format_global != PAGE_LAYOUT)