Le 15/04/2022 à 11:45, Thomas Morley a écrit :
Am Fr., 15. Apr. 2022 um 10:39 Uhr schrieb Jean Abou Samra <j...@abou-samra.fr>:
Le 15/04/2022 à 10:13, Thomas Morley a écrit :
Am Mi., 13. Apr. 2022 um 17:57 Uhr schrieb Jean Abou Samra <j...@abou-samra.fr>:
Le 13/04/2022 à 17:03, Thomas Morley a écrit :
Am Di., 12. Apr. 2022 um 11:54 Uhr schrieb Jean Abou Samra <j...@abou-samra.fr>:
Le 12/04/2022 à 11:16, Thomas Morley a écrit :
[...]
In many details DurationLine was tailored after Glissando and
Glissando _is_ effected by the breathing sign.
[...]
Well, if the goal is to have DurationLine similar to Glissando,
how about reusing line-spanner-interface code? I haven't reviewed
the code very thoroughly, but I assumed there was a difference
warranting a different code path. If you put
ly:line-spanner::calc-{left,right}-bound-info in
DurationLine.{left,righ}-bound-info, that gives you X values for free
in the bound info properties. Would that solve the problem?
If I go for ly:line-spanner::calc-{left,right}-bound-info then
\layout {
\context {
\Voice
\consists Duration_line_engraver
}
}
{ b1\- }
errors with
"programming error: extremal broken spanner's bound has no parent
vertical axis group"
More complex examples may add:
"programming error: bound item has no parent vertical axis group"
Both coming from `ly:line-spanner::calc-right-bound-info' based upon
`Line_spanner::calc_bound_info' in /lily/line-spanner.cc
As a mere user I'd say: "Nice error-message, but why should I care...?"
As a programmer, I doubt the example above can be made working with
ly:line-spanner::calc-right-bound-info.
At least, I don't know how.
Oh, I'm sorry, I missed that detail of my own code. A DurationLine will
always be horizontal, thus you can and should use
ly:horizontal-line-spanner::calc-{left,right}-bound-info (with 'horizontal'
in the name). The difference is that the functions without 'horizontal'
try to compute vertical positions. This falls apart here, for understandable
reasons: the right bound of your DurationLine is a NonMusicalPaperColumn,
so how would one tell where the line should end vertically?
Using ly:horizontal-line-spanner::calc-{left,right}-bound-info makes
for huge simplifications.
Alas, it introduces a minor and reintroduces a major problem.
The minor: the X-value depends now on attach-dir. For the start of the
DurationLine this is ofcourse RIGHT. But if starting at a skip,
left-bound is PaperColumn there we would want LEFT. Can be fixed by
accurate conditions. Count it as done.
The major: `ly:horizontal-line-spanner::calc-right-bound-info' and
`unbroken-or-last-broken-spanner?' (and friends) don't agree what's
the last part of the spanner.
To illustrate:
\version "2.23.7"
\layout {
\context {
\Voice
\consists "Duration_line_engraver"
}
}
{
\override DurationLine.bound-details.right.foo =
"I am last part (bound-details)"
\override DurationLine.bound-details.right-broken.foo =
"I am not last part (bound-details)"
\override DurationLine.after-line-breaking =
#(lambda (grob)
(pretty-print
(if (unbroken-or-last-broken-spanner? grob)
"I am last part (unbroken-or-last-broken-spanner?)"
"I am not last part (unbroken-or-last-broken-spanner?)"))
(pretty-print
(assoc-get 'foo (ly:horizontal-line-spanner::calc-right-bound-info
grob))))
b1\-
}
=>
"I am last part (unbroken-or-last-broken-spanner?)"
"I am not last part (bound-details)"
The problem occurs if we have a broken DurationLine with end-items
running to the very end of the score.
To fix it one would again need something like:
{
\override DurationLine.bound-details =
#(grob-transformer 'bound-details
(lambda (grob orig)
(if (end-broken-spanner? grob)
(cons
(cons 'right-broken
(cons '(end-style . arrow) (assoc-get 'right-broken orig)))
orig)
orig)))
b1\-
\break
s1
\break
s1
\bar "|."
}
Or like \lastEndStyle which you cleared with
commit 46671d13257f6ad68d1778a1cc850e59116c856a
Author: Jean Abou Samra <j...@abou-samra.fr>
Date: Wed Dec 29 00:16:46 2021 +0100
Fix broken spanner functions
They were broken (pun intended) on spanners of which one bound is a
non-musical column at a system boundary. For example,
unbroken-or-last-broken-spanner? would return false on a spanner
running to the NonMusicalPaperColumn at the end of a score. This
fixes the known issue with duration lines running to the end of the
piece, and will be needed in a refactoring of spanner-placement
treatment for balloon-interface.
While at it, document these functions.
This is unfortunate. Any chance making
`ly:horizontal-line-spanner::calc-right-bound-info' and friends
identify the last spanner-part correctly, i.e. like
`unbroken-or-last-broken-spanner?'
?
Ah, this one is showing up again. Yes, this is not too hard to
fix (but please allow me some time).
No problem.
If you don't mind I'll open an issue for it with the code-example above.
Meanwhile I found a different workaround, without the need to have the
apply an extra override.
If testings suceed, I'll upload a patch with the new code for DurationLine.
The workaround could be removed later easily.
The attached patch fixes it for me.
Thanks,
Jean
From 55f98fdb6ebc7f5e86c1380469e966d508fe2dfa Mon Sep 17 00:00:00 2001
From: Jean Abou Samra <j...@abou-samra.fr>
Date: Fri, 15 Apr 2022 12:39:29 +0200
Subject: [PATCH] Fix broken details used for line spanner running to end of
the piece
This is relevant for a line spanner running to the end of the piece if
its right bound is a breakable item. It should use bound-details.right,
but not bound-details.right-broken, in spite of the right bound being a
broken item.
---
lily/include/lily-imports.hh | 2 ++
lily/lily-imports.cc | 2 ++
lily/line-spanner.cc | 10 ++++++++--
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/lily/include/lily-imports.hh b/lily/include/lily-imports.hh
index 0f4a777347..dfb0f656ea 100644
--- a/lily/include/lily-imports.hh
+++ b/lily/include/lily-imports.hh
@@ -149,6 +149,8 @@ extern Variable stencil_whiteout;
extern Variable stencil_whiteout_box;
extern Variable symbol_list_p;
extern Variable type_name;
+extern Variable unbroken_or_first_broken_spanner_p;
+extern Variable unbroken_or_last_broken_spanner_p;
extern Variable volta_bracket_calc_hook_visibility;
extern Variable write_performances_midis;
extern Variable write_lilypond_book_aux_files;
diff --git a/lily/lily-imports.cc b/lily/lily-imports.cc
index a6bf048b76..a6ed7bbffc 100644
--- a/lily/lily-imports.cc
+++ b/lily/lily-imports.cc
@@ -137,6 +137,8 @@ Variable scorify_music ("scorify-music");
Variable stencil_whiteout ("stencil-whiteout");
Variable symbol_list_p ("symbol-list?");
Variable type_name ("type-name");
+Variable unbroken_or_first_broken_spanner_p ("unbroken-or-first-broken-spanner?");
+Variable unbroken_or_last_broken_spanner_p ("unbroken-or-last-broken-spanner?");
Variable volta_bracket_calc_hook_visibility ("volta-bracket::calc-hook-visibility");
Variable write_performances_midis ("write-performances-midis");
Variable write_lilypond_book_aux_files ("write-lilypond-book-aux-files");
diff --git a/lily/line-spanner.cc b/lily/line-spanner.cc
index 87cd9edb71..8af0197dd0 100644
--- a/lily/line-spanner.cc
+++ b/lily/line-spanner.cc
@@ -23,6 +23,7 @@
#include "grob.hh"
#include "grob-interface.hh"
#include "item.hh"
+#include "lily-imports.hh"
#include "lily-proto.hh"
#include "line-interface.hh"
#include "note-column.hh"
@@ -106,7 +107,7 @@ offsets_maybe (Drul_array<Grob *> grobs, Grob *&common)
SCM
Line_spanner::calc_bound_info (SCM smob, Direction dir, bool horizontal)
{
- Spanner *me = unsmob<Spanner> (smob);
+ Spanner *me = LY_ASSERT_SMOB (Spanner, smob, 0);
Item *bound_item = me->get_bound (dir);
@@ -116,7 +117,12 @@ Line_spanner::calc_bound_info (SCM smob, Direction dir, bool horizontal)
? ly_symbol2scm ("left")
: ly_symbol2scm ("right"), bound_details, SCM_BOOL_F);
- if (bound_item->break_status_dir ())
+ // Don't use break_status_dir (): a spanner running to the end of the piece
+ // has a broken right bound, but should not get details from right-broken.
+ Lily::Variable checker = ((dir == LEFT)
+ ? Lily::unbroken_or_first_broken_spanner_p
+ : Lily::unbroken_or_last_broken_spanner_p);
+ if (!from_scm<bool> (checker (smob)))
{
SCM extra = ly_assoc_get ((dir == LEFT)
? ly_symbol2scm ("left-broken")
--
2.32.0