lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: list of thicknesses affected by changing StaffSymbol.thickness


From: Thomas Morley
Subject: Re: list of thicknesses affected by changing StaffSymbol.thickness
Date: Sun, 31 Jan 2016 21:09:53 +0100

2016-01-31 17:31 GMT+01:00 Pierre Perol-Schneider
<address@hidden>:
> Hi Kieren,
>
> I've never seen such list but it would be helpful.
> Apparently, StaffSymbol.thickness affects spanners (not all of them)
> proportionally:
> http://www.lilypond.org/doc/v2.19/Documentation/notation/spanners
> but also ledger lines, stem thickness, beam length fraction, beam
> attachment... (others for sure) in a less predictable multiplier:
>
> \version "2.19.35"
>
> \score {
>    {
>     \new GrandStaff <<
>       \new Staff { c'''16 c' c''' c' c''' c' }
>       \new Staff { c'''16 c' c''' c' c''' c' }
>     >>
>   }
> }
> \markup\vspace #2
> \score {
>   {
>     \new GrandStaff <<
>       \new Staff { c'''16\< c'\glissando c''' c'\startTrillSpan c'''
> c'\!\stopTrillSpan }
>       \new Staff { c'''16\startTextSpan c'~ c' c' c''' c'\stopTextSpan }
>     >>
>   }
>   \layout {
>     \context {
>       \Staff
>       \override StaffSymbol.thickness = 5
>       \override StaffSymbol.ledger-line-thickness = #'(0.13 . 0.13)
>       \override Stem.thickness = #0.25
>       \override Beam.length-fraction = #0.8
>     }
>   }
> }
>
> Not sure if that helps though... :(
> Cheers,
> Pierre
>
>
>
> 2016-01-31 14:53 GMT+01:00 Kieren MacMillan <address@hidden>:
>>
>> Hello all,
>>
>> I was just checking to see if anyone has an answer to my post of Jan 7:
>>
>> > Is there a single list somewhere in the documentation, of all the grobs
>> > whose sizes are tied to StaffSymbol.thickness?
>> > (Optimally, that list would also include each grob’s default
>> > multiplier/thickness.)
>>
>> Alternatively, if anyone knows a ways to adjust the staff line thickness
>> *without* triggering an increase in all the other related thicknesses, that
>> would be a great (perhaps better) way to solve the issue I’m currently
>> working on.
>>
>> Thanks,
>> Kieren.

Hi Kieren, Pierre,

currently I see no reasonable method to get such a list.

You may use
(1) Trial and error.  I know ....
(2) Or the code below.
Though be aware: It's last ressort!
I'm not sure, whether I can recommend using it.
If you wanna try, please test _very_ thoroughly!!
It post-processes the stencil-expression. The function's arg is added
to the default value.

Though you'll notice a drawback while only changing
StaffSymbol.thickness: the SystemStartBar is not affected, so the
thicker staff-lines stick out a bit.

\version "2.19.35"

%% Using Pierre's example.

#(define (lists-map function ls)
"Apply @var{function} to @var{ls} and all of it sublists.
First it recurses over the children, then the function is applied to
@var{ls}."
    (if (list? ls)
        (set! ls (map (lambda (y) (lists-map function y)) ls))
        ls)
    (function ls))

#(define (affect-staff-symbol-stencil-thickness add-th)
  (lambda (grob)
    (let* ((stil (ly:staff-symbol::print grob))
           (x-ext (ly:stencil-extent stil X))
           (y-ext (ly:stencil-extent stil Y))
           (stil-expr (ly:stencil-expr stil)))
      (ly:make-stencil
        (lists-map
          (lambda (e)
           (if (and (list? e) (member 'draw-line e))
               (append (list 'draw-line (+ (cadr e) add-th)) (cddr e))
               e))
           stil-expr)
         x-ext
         y-ext))))

affectStaffSymbolStencilThickness =
#(define-music-function (add-thick)(number?)
#{
  \override Staff.StaffSymbol.stencil =
    #(affect-staff-symbol-stencil-thickness add-thick)
#})

\paper {
  indent = 50
}

mus =
{ c'''16\< c'\glissando c''' c'\startTrillSpan c''' c'\!\stopTrillSpan }

\new Staff \with { instrumentName = "default" } \mus

\score {
  {
    \new GrandStaff <<
      \new Staff
        \with {
          instrumentName = "thick is increased 0.2 "
          \affectStaffSymbolStencilThickness #0.2
        }
        \mus
      \new Staff
        \with {
          instrumentName = "thick is increased 0.4 "
          \affectStaffSymbolStencilThickness #0.4
        }
        \mus
      \new Staff
      \with {
        instrumentName = "reverted "
        \revert StaffSymbol.stencil
      }
      \mus
    >>
  }
  \layout {
    \context {
      \Staff
      %% general setting is also possible:
      %\affectStaffSymbolStencilThickness #0.4
    }
  }
}

Cheers,
  Harm



reply via email to

[Prev in Thread] Current Thread [Next in Thread]