[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RehearsalMark hack
From: |
Simon Bailey |
Subject: |
Re: RehearsalMark hack |
Date: |
Wed, 23 Nov 2005 14:52:22 +0100 |
hi mats, bruce,
On 11/23/05, Mats Bengtsson <address@hidden> wrote:
> For the horizontal position, why did you not directly redefine the
> function that handles the placement av rehearsal marks after line
> breaks? The default function has the following definition (from
> scm/output-lib.scm):
>
> (define-public (shift-right-at-line-begin g)
> "Shift an item to the right, but only at the start of the line."
> (if (and (ly:item? g) (equal? (ly:item-break-dir g) RIGHT))
> (ly:grob-translate-axis! g 3.5 X)))
>
> and you can specify your own function using:
> \override Score.RehearsalMark #'after-line-breaking-callback =
> #my-shift-right-at-line-begin
i didn't redefine this function, because i didn't know that
rehearsalmarks were categorically shifted to the right at the
beginning of a line. it is not stated in the documentation that this
property is set to #shift-right-at-line-begin by default.
in fact, the only documentation for after-line-breaking-callback is:
"This procedure is called after line breaking. Its return value is
ignored." in docs for 2.6 at:
http://lilypond.org/doc/v2.6/Documentation/user/out-www/lilypond-internals/grob_002dinterface.html
and:
"Dummy property, used to trigger callback for after-line-breaking" in
the docs for 2.7 at:
http://lilypond.org/doc/v2.6/Documentation/user/out-www/lilypond-internals/grob_002dinterface.html
my naive assumption was that there is an invisible bar-line after
prefatory matter over which rehearsal marks are aligned. (probably
because of this:
http://lilypond.org/doc/v2.6/input/regression/out-www/lily-1278860194.ly)
my solution is almost the same as your's if i'm not mistaken, except
for the fact that it is called before a line break, rather than after
(which is probably better and which i will change now).
fairchild wrote:
> Impressive detective work. Please add commentary about the documentation
> trail you followed to discover your result. Maybe include some explanation of
> what code does what.
the documentation trail:
Difficult tweaks:
http://lilypond.org/doc/v2.6/Documentation/user/out-www/lilypond/Difficult-tweaks.html
--> defining a 2-line callback function for after line breaking which
just categorically changed the extra-offset property. that didn't
work, so i started reading the scheme functions for lily:
http://lilypond.org/doc/v2.7/Documentation/user/out-www/lilypond-internals/Scheme-functions.html
and searching for break led me to the ly:item-break-dir function.
checking for beginning of line was then a matter of working out how to
do an if branch in scheme.
code comments:
% define a function called mark-callback which receives "grob" as a parameter
#(define (mark-callback grob)
% is this item is at the beginning of the line (ly:item-break-dir returns 1)
(if (= (ly:item-break-dir grob) 1)
% set extra-offset to the desired shift.
(ly:grob-set-property! grob 'extra-offset '(-2.8 . 1))))
the \book and \repeat commands are well documented in the manual.
\repeat definitely is, and i only used it out of laziness in this
example.
for 2.4. and 2.6. please use Mats' version which is:
\override Score.RehearsalMark #'after-line-breaking-callback = #mark-callback
Mats' version is semantically more correct -- the only difference
being that this callback seems to shift further to the left.
sample output again at:
http://binabik.boldlygoingnowhere.org/r-marks.pdf
the whole reason i wanted this hack was for the following scenario:
http://binabik.boldlygoingnowhere.org/trbns/
all three files are generated from the same source. i was having
problems with the first piece in the "marschbuch" format
(a5-landscape). lily's solution is in the "standard" version and
collides nastily with the multimeasure rests; my solution is visible
in the "hacked" version. [nb, the staff line vertical spacing has been
seriously overriden in this document]. the reason i didn't want to
hard code this in the source files is because of the concert.pdf and
score.pdf which are generated from the same sources.
regards,
sb
--
Do not meddle in the affairs of trombonists, for they are subtle and
quick to anger.