From 04fba015ab77fb8e6765b86ca73787cfea78df6e Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sun, 21 Mar 2004 00:01:52 +0000 Subject: [PATCH] * 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. --- ChangeLog | 7 +++++++ lily/include/stencil.hh | 5 +++++ lily/paper-outputter.cc | 2 +- lily/stencil-scheme.cc | 3 ++- lily/system.cc | 29 +++++++++++++++++------------ 5 files changed, 32 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9f45dbb2b5..da4dee423b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-03-21 Han-Wen Nienhuys + + * 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 * lily/tie-performer.cc (acknowledge_audio_element): bugfix: use diff --git a/lily/include/stencil.hh b/lily/include/stencil.hh index 41f495e998..0af30a3d63 100644 --- a/lily/include/stencil.hh +++ b/lily/include/stencil.hh @@ -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_; diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index dff731a0ec..f3ff1e1898 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -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); diff --git a/lily/stencil-scheme.cc b/lily/stencil-scheme.cc index 0f859d8227..79ab518636 100644 --- a/lily/stencil-scheme.cc +++ b/lily/stencil-scheme.cc @@ -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; diff --git a/lily/system.cc b/lily/system.cc index 350834f79e..f0633da0c3 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -73,26 +73,25 @@ uniquify_list (SCM l) int len = scm_ilength (l); SCM * arr = new SCM[len]; int k = 0; - for (SCM s =l ; 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) -- 2.39.5