[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: two consecutive \mark at end and beginning of line
From: |
Jacques Menu |
Subject: |
Re: two consecutive \mark at end and beginning of line |
Date: |
Tue, 10 Nov 2015 09:32:28 +0100 |
Hello Federico,
Someone on this list contributed a multi-mark-engraver, does that help you?
JM
\version "2.18.2"
% From: http://lists.gnu.org/archive/html/lilypond-user/2011-08/msg00157.html
#(define (multi-mark-engraver ctx)
(let ((texts '())
(final-texts '())
(events '()))
`((start-translation-timestep
. ,(lambda (trans)
(set! final-texts '())))
(listeners
(mark-event
. ,(lambda (trans ev)
(set! events (cons ev events)))))
(acknowledgers
(break-alignment-interface
. ,(lambda (trans grob source)
(for-each (lambda (mark)
(set! (ly:grob-parent mark X) grob))
texts))))
(process-music
. ,(lambda (trans)
(for-each
(lambda (ev)
(let* ((mark-grob
(ly:engraver-make-grob trans 'RehearsalMark ev))
(label (ly:event-property ev 'label))
(formatter (ly:context-property ctx 'markFormatter)))
(if (and (procedure? formatter)
(not (markup? label)))
(begin
(if (not (number? label))
(set! label
(ly:context-property ctx 'rehearsalMark)))
(if (and (integer? label)
(exact? label))
(set! (ly:context-property ctx 'rehearsalMark)
(1+ label)))
(if (number? label)
(set! label (apply formatter (list label ctx)))
(ly:warning "rehearsalMark must have
integer value"))))
(if (markup? label)
(begin
(set! (ly:grob-property mark-grob 'text) label)
(let ((dir (ly:event-property ev 'direction)))
(and (ly:dir? dir)
(set! (ly:grob-property mark-grob 'direction)
dir))))
(ly:warning "mark label must be a markup object"))
(set! texts (cons mark-grob texts))))
(reverse events))))
(stop-translation-timestep
. ,(lambda (trans)
(if (pair? texts)
(let ((staves (ly:context-property ctx 'stavesFound))
(priority-index 0))
(for-each (lambda (grob)
(let ((my-priority (ly:grob-property
grob 'outside-staff-priority 1500)))
(for-each (lambda (stave)
(ly:pointer-group-interface::add-grob grob 'side-support-elements
stave))
staves)
(set! (ly:grob-property grob
'outside-staff-priority) (+ my-priority priority-index))
(set! priority-index (1+ priority-index))
(set! final-texts (cons grob final-texts))))
(reverse texts))
(set! texts '())
(set! events '())))))
(finalize
. ,(lambda (trans)
(and (pair? final-texts)
(for-each (lambda (grob)
(set! (ly:grob-property grob 'break-visibility)
end-of-line-visible))
final-texts)))))))
\layout {
\context {
\Score
\remove "Mark_engraver"
\consists #multi-mark-engraver
\consists "Tweak_engraver"
}
}
markDown =
#(define-music-function (parser location text) (markup?)
(make-music 'MarkEvent
'direction DOWN
'label text))
myMark =
#(define-music-function (parser location text) (markup?)
(make-music 'MarkEvent
'label text))
toCoda = {
\tweak #'self-alignment-X #RIGHT
\tweak #'break-visibility #begin-of-line-invisible
\myMark \markup { to \hspace #1.25 \raise #1.25 \musicglyph #"scripts.coda" }
}
\relative c' {
c1 | c | c | c \toCoda
\bar "||" \break
\mark \default
c1 | c |
\mark \default
\markDown "23"
c | c
}
> Le 10 nov. 2015 à 08:47, Federico Bruni <address@hidden> a écrit :
>
> Hi folks
>
> There's any way to let lilypond print the second mark in this minimal example?
>
> \version "2.19.31"
>
> \relative {
> \repeat unfold 8 c'1
> \once \override Score.RehearsalMark.break-visibility = #end-of-line-visible
> \once \override Score.RehearsalMark.self-alignment-X = #RIGHT
> \mark \markup { \musicglyph #"scripts.segno" }
> \break
>
> \mark \default
> f1
> }
>
> I'm getting this warning:
> warning: Two simultaneous mark events, junking this one
>
> As the first mark is at the end of line and the second at the beginning,
> there's no chance of collision. I would expect lilypond to print it.
>
> I think that my case is a little bit different from these snippets:
> http://lsr.di.unimi.it/LSR/Item?id=735
> http://lsr.di.unimi.it/LSR/Item?id=736
>
> Wait, I think I found the right snippet:
> http://lsr.di.unimi.it/LSR/Item?id=892
>
> but it's way too complex for such an easy task. I'd rather go for a formatted
> \markup instead of adding such a complexity in my scores.
>
> Thanks in advance for any advice
> Federico
>
>
>
>
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user