[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 10:15:26 +0100 |
Oops, completely missed the target…
The complex example by Arnold Theresius on LSR boils down in your case to the
following.
HTH!
JM
%%%%%%%%%%%%%%%%
\version "2.19.30"
% http://lsr.di.unimi.it/LSR/Snippet?id=892
%by: ArnoldTheresius
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% START of my personal include file 'double-mark.ly'
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#(define-public (string-or-markup-or-boolean? e)
(or (string? e) (markup? e) (boolean? e)))
#(define (music-property-description symbol type? description)
(if (not (equal? #f (object-property symbol 'music-doc)))
(ly:error (_ "symbol ~S redefined") symbol))
(set-object-property! symbol 'music-type? type?)
(set-object-property! symbol 'music-doc description)
symbol)
#(for-each
(lambda (x)
(apply music-property-description x))
`((left-label
,string-or-markup-or-boolean?
"set the left part of a RehearsalMark")
(right-label
,string-or-markup-or-boolean?
"set the right part of a RehearsalMark")
))
#(define (double-rehearsalmark-stencil grob)
(let*
((grobs-event (ly:grob-property grob 'cause '()))
(left-label (ly:event-property grobs-event 'left-label))
(right-label (ly:event-property grobs-event 'right-label))
(gap (ly:grob-property grob 'gap 1.4)))
(case (ly:item-break-dir grob)
((-1)
(if (boolean? left-label) empty-stencil
(grob-interpret-markup grob
(make-right-align-markup left-label))))
((1)
(if (boolean? right-label) empty-stencil
(grob-interpret-markup grob
(make-left-align-markup right-label))))
(else
(if (boolean? left-label)
(grob-interpret-markup grob
(if left-label
(make-center-align-markup right-label)
(make-left-align-markup right-label)))
(if (boolean? right-label)
(grob-interpret-markup grob
(if right-label
(make-center-align-markup left-label)
(make-right-align-markup left-label)))
(ly:stencil-add
(ly:stencil-translate
(grob-interpret-markup grob
(make-right-align-markup left-label))
(cons (* -0.5 gap) 0.0))
(ly:stencil-translate
(grob-interpret-markup grob
(make-left-align-markup right-label))
(cons (* 0.5 gap) 0.0)))))))))
doubleMark =
#(define-music-function
(parser location left-string right-string)
(string-or-markup-or-boolean? string-or-markup-or-boolean?)
(if (and (boolean? left-string) (boolean? right-string))
(ly:warning "~a \\doubleMark - at least one string or markup required"
location))
(make-music 'SequentialMusic
'elements (list
(make-music 'ContextSpeccedMusic
'context-type 'Score
'element
(make-music 'OverrideProperty
'symbol 'RehearsalMark
'grob-value double-rehearsalmark-stencil
'grob-property-path (list 'stencil)
'pop-first #t
'once #t))
(make-music 'ContextSpeccedMusic
'context-type 'Score
'element
(make-music 'OverrideProperty
'symbol 'RehearsalMark
'grob-value #f
'grob-property-path (list 'self-alignment-X)
'pop-first #t
'once #t))
(make-music 'ContextSpeccedMusic
'context-type 'Score
'element
(make-music 'OverrideProperty
'symbol 'RehearsalMark
'grob-value `#(,(not (boolean? left-string))
#t
,(not (boolean? right-string)))
'grob-property-path (list 'break-visibility)
'pop-first #t
'once #t))
(make-music 'MarkEvent
'label #f
'left-label (if (string? left-string)
(make-simple-markup left-string)
left-string)
'right-label (if (string? right-string)
(make-simple-markup right-string)
right-string)
'origin location))))
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% END of my personal include file 'double-mark.ly'
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\relative {
\repeat unfold 8 c'1
\once \override Score.RehearsalMark.break-visibility = #end-of-line-visible
\once \override Score.RehearsalMark.self-alignment-X = #RIGHT
\doubleMark
\markup { \musicglyph #"scripts.segno" }
\markup { \bold "A" }
\break
f1
}
%%%%%%%%%%%%%%%%
> Le 10 nov. 2015 à 09:32, Jacques Menu <address@hidden> a écrit :
>
> Hello Federico,
>
> Someone on this list contributed a multi-mark-engraver, does that help you?
>
> JM
>
>
>> 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
>