To me, this would seem to suggest that the "less invasive" bugfix I
proposed (by rounding) would in fact preserve the incompleteness in
the move from int to float calculations that Han-Wen probably
introduced by accident (unless (*) is motivated in a way I do not
understand). This would seem to me to suggest that (*) should be
replaced by a straight "lastpos = p;".
Agreed.
It all comes down to the question I can't answer due to lack of
knowledge about the internal workings: What's the rationale for the
claim that dy can only be integer or .5?
I think short of rewriting everything to use integers again, removing
the int cast seems like the fix more in line with what the code is
currently written to do/be.
Ok, done.
@James, I attach the updated complete patch set; could you integrate the
second patch? (Assuming incremental patch sets are ok?). Sorry for
bothering you again with this!
Lukas
>From 0cfeca9c71bde48e2cc969b0075d1cebf801b600 Mon Sep 17 00:00:00 2001
From: Lukas-Fabian Moser <l...@gmx.de>
Date: Fri, 5 Jul 2019 16:45:31 +0200
Subject: [PATCH 2/2] Maintain float precision during calculation of attachment
of noteheads to chord (thus completing the transition from int-calculations
to floats introduced in e7cb72c9fce).
---
lily/stem.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lily/stem.cc b/lily/stem.cc
index 34bf557fca..2a0f6fef84 100644
--- a/lily/stem.cc
+++ b/lily/stem.cc
@@ -626,7 +626,7 @@ Stem::calc_positioning_done (SCM smob)
else
parity = true;
- lastpos = int (round (p));
+ lastpos = p;
}
return SCM_BOOL_T;
--
2.17.1
>From 36f2d4e768c1a14c668ab5d132099969796cc5fb Mon Sep 17 00:00:00 2001
From: Lukas-Fabian Moser <l...@gmx.de>
Date: Thu, 4 Jul 2019 16:18:50 +0200
Subject: [PATCH 1/2] In loop calculating the attachments of chord node heads
to stem, calculate last used position by _rounding_ to int rather than by
truncating to int. This fixes issue 5303 (misplaced note head bug).
Also add regression test.
---
input/regression/misplaced-note-head-bug.ly | 15 +++++++++++++++
lily/stem.cc | 2 +-
2 files changed, 16 insertions(+), 1 deletion(-)
create mode 100644 input/regression/misplaced-note-head-bug.ly
diff --git a/input/regression/misplaced-note-head-bug.ly b/input/regression/misplaced-note-head-bug.ly
new file mode 100644
index 0000000000..2a645f2a57
--- /dev/null
+++ b/input/regression/misplaced-note-head-bug.ly
@@ -0,0 +1,15 @@
+\version "2.19.16"
+
+\header {
+
+ texidoc = "Misplaced note head bug (issue 5303) should be fixed."
+
+}
+
+\layout {
+ #(layout-set-staff-size 19)
+}
+
+
+{ <d' f' a'>2 \clef bass <f, a, c> }
+
diff --git a/lily/stem.cc b/lily/stem.cc
index 37aa40c250..34bf557fca 100644
--- a/lily/stem.cc
+++ b/lily/stem.cc
@@ -626,7 +626,7 @@ Stem::calc_positioning_done (SCM smob)
else
parity = true;
- lastpos = int (p);
+ lastpos = int (round (p));
}
return SCM_BOOL_T;
--
2.17.1
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel