Le 13/04/2022 à 17:57, Jean Abou Samra a écrit :
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?
If there is a reason to keep DurationLine calculations separate, you
could go for using ly:generic-bound-extent. The line-spanner-interface
uses its C++ equivalent internally.
Didn't try this so far.
But the description:
"Function: ly:generic-bound-extent grob common
Determine the extent of grob relative to common along the x axis,
finding its extent as a bound when it a has bound-alignment-interfaces
property list set and otherwise the full extent."
is kryptic to say the least.
It's in a sense similar to the (so far nonexistent/C++-only) function
ly:axis-group-interface::staff-extent we discussed, except that it
doesn't filter grobs for having a certain grob in their ancestry,
but for having one of certain interfaces, captured in the
bound-alignment-interfaces property. E.g., for NonMusicalPaperColumn,
this property defaults to '(break-alignment-interface), which means
that
(ly:generic-bound-extent [NonMusicalPaperColumn] [System])
gives you the extent of the elements of the NonMusicalPaperColumn
that are part of a BreakAlignment, i.e. grobs with the
break-aligned-interface,
like BarLine, KeySignature, etc., but not those that are outside
of a BreakAlignment, i.e. those having the break-*aligned*-interface
And of course that one should have been 'alignable' ...
(tricky difference, I know, I always need to look up which is 'alignable'
and which is 'aligned' ...), namely MetronomeMark, RehearsalMark, ...
There are some slightly fussy details, but that's the idea. Is that
clear?
HTH,
Jean