[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Text Spanner, with Text left-aligned to bar-line, and spanner line r
From: |
David Nalesnik |
Subject: |
Re: Text Spanner, with Text left-aligned to bar-line, and spanner line right-aligned to subsequent bar-line? |
Date: |
Mon, 1 Oct 2012 19:27:30 -0500 |
Hi Zenaan,
On Mon, Oct 1, 2012 at 3:53 PM, Thomas Morley
<address@hidden> wrote:
> 2012/10/1 Zenaan Harkness <address@hidden>:
>> G'day, FP here.
>>
>> Here's my code:
>> capoVHalf = {
>> %\context { \Score \override RehearsalMark #'self-alignment-X = #RIGHT }
>> %\override TextSpanner #'(bound-details l X) = #0
>> %\override TextSpanner #'(bound-details right X) = #40
>> %\override TextSpanner #'(bound-details right padding) = #-20
>> %\once \override Score.RehearsalMark #'self-alignment-X = #LEFT
>> %\once \override TextSpanner #'(bound-details left
>> stencil-align-dir-X) = #LEFT
>> \once \override TextSpanner #'to-barline = ##t
>> \once \override TextSpanner #'dash-fraction = #0.6
>> \once \override TextSpanner #'(bound-details left text) = \markup {
>> \tiny { "½ Capo V" } }
>> }
>>
>> It seems I can align around a bar-line, if I just use a text Mark, and
>> can only align the text (rehearsal mark) to a note if I want a spanner
>> line, eg for a guitar Capo marking, with the line extending over the
>> bars that the capo applies to.
>> This is standard notation for guitars.
>>
>> I can right-align the spanner line as seen above ( #'to-barline = ##t)
>> by moving the corresponding \stopTextSpan to _after_ the subsequent
>> note to which it really applies, but at least it looks right.
>>
>> But I can't get the text left aligned to the start of the bar in which
>> it appears; it always aligns around the center of the note to which it
>> follows.
>>
>> Any one know if it's possible to achieve proper Capo notating with lilypond?
>>
>> Thanks in advance
>> Zenaan
>>
>> _______________________________________________
>> lilypond-user mailing list
>> address@hidden
>> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
> Hi Zenaan,
>
> I'm tired of a hard day's work.
> Although I'm interested in this stuff (being a guitarist myself), I
> will not work on your code unless you provide a compilable
> code-example illustrating your problem.
>
> -Harm
>
A fully compiling example certainly would make this clearer!
You can always guess at values for 'bound-details on the left.
Here's something which will snap the left text to the bar line, and
save you this guesswork. At this point, it's a bit limited: it will
snap the text to the bar line wherever you start the spanner in the
measure, and it will return an error if you try to use it across a
line break.
Anyway, hope there's some use in this.
\version "2.16.0"
#(define (capo grob)
(let* ((sys (ly:grob-system grob))
(cols (ly:grob-object sys 'columns))
(cols-list (ly:grob-array->list cols))
; find the rank of the PaperColumn which parents the left bound
; of our text spanner
(my-ref-L
(list-index
(lambda (col)
(eq? col (ly:grob-object (ly:spanner-bound grob LEFT)
'axis-group-parent-X)))
cols-list))
; find the nearest NonMusicalPaperColumn to the left of the PaperColumn
(nearest-non-musical
(let loop ((x (- (length cols-list) my-ref-L)))
(let ((y (list-ref (reverse cols-list) x)))
(if (eq? #t (ly:grob-property y 'non-musical))
y
(loop (1+ x)))))))
; set the left bound of the spanner to the NonMusicalPaperColumn
(ly:spanner-set-bound! grob LEFT nearest-non-musical)))
capoVHalf = {
\once \override TextSpanner #'to-barline = ##t
\once \override TextSpanner #'dash-fraction = #0.6
\once \override TextSpanner #'(bound-details left padding) = #0
\once \override TextSpanner #'(bound-details left text) = \markup {
\tiny { "½ Capo V" } }
\once \override TextSpanner #'after-line-breaking = #capo
}
\relative c' {
c c c c
\capoVHalf
c\startTextSpan c c c
c c c c
c\stopTextSpan c c c
\capoVHalf
c\startTextSpan c c c
c c c c
c c c c
c\stopTextSpan c c c
}
- Text Spanner, with Text left-aligned to bar-line, and spanner line right-aligned to subsequent bar-line?, Zenaan Harkness, 2012/10/01
- Re: Text Spanner, with Text left-aligned to bar-line, and spanner line right-aligned to subsequent bar-line?, Thomas Morley, 2012/10/01
- Re: Text Spanner, with Text left-aligned to bar-line, and spanner line right-aligned to subsequent bar-line?,
David Nalesnik <=
- Re: Text Spanner, with Text left-aligned to bar-line, and spanner line right-aligned to subsequent bar-line?, David Nalesnik, 2012/10/01
- Re: Text Spanner, with Text left-aligned to bar-line, and spanner line right-aligned to subsequent bar-line?, David Nalesnik, 2012/10/01
- Message not available
- Re: Text Spanner, with Text left-aligned to bar-line, and spanner line right-aligned to subsequent bar-line?, Zenaan Harkness, 2012/10/02
- Re: Text Spanner, with Text left-aligned to bar-line, and spanner line right-aligned to subsequent bar-line?, David Nalesnik, 2012/10/02
- Re: Text Spanner, with Text left-aligned to bar-line, and spanner line right-aligned to subsequent bar-line?, Zenaan Harkness, 2012/10/02
- Re: Text Spanner, with Text left-aligned to bar-line, and spanner line right-aligned to subsequent bar-line?, David Nalesnik, 2012/10/02
- Re: Text Spanner, with Text left-aligned to bar-line, and spanner line right-aligned to subsequent bar-line?, Janek Warchoł, 2012/10/02
- Re: Text Spanner, with Text left-aligned to bar-line, and spanner line right-aligned to subsequent bar-line?, David Nalesnik, 2012/10/02
Re: Text Spanner, with Text left-aligned to bar-line, and spanner line right-aligned to subsequent bar-line?, Zenaan Harkness, 2012/10/02