lilypond-devel
[Top][All Lists]
Advanced

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

Re: Gets rid of length in the docs. (issue 4965053)


From: Mike Solomon
Subject: Re: Gets rid of length in the docs. (issue 4965053)
Date: Tue, 30 Aug 2011 16:08:20 +0200

On Aug 30, 2011, at 2:31 PM, Dmytro O. Redchuk wrote:

> On Tue 30 Aug 2011, 15:02 I wrote:
>> Being a user, I often used to override 'Y-extent for some specific purposes:
>> 
>> {
>>  \override Stem #'Y-extent = #'(-10 . 0)
>>  c''_\fermata
>> }
> Oh, yes, 2.15.9 changes stem's length.
> 
> 2.15.8 and below did not change it.
> 
> 2.15.8 and below changed grob's _extent_, but not appearance. It was good. For
> some/other grobs there are (a lot of?) places in the docs, when it's suggested
> to set 'Y-extent to (-inf.0 . +inf.0) for some purposes. If I can remember.
> Or to set in to (0 . 0) to make grob "to have no extent". But it didn't change
> grob's appearance.
> 
> Sorry my jumping in though. Very probably, I've missed something important.

Not at all - you're absolutely right, and I certainly think you make a valid 
argument for having a property that controls the grob's look.  It could be 
#'length, although the problem with length is that it presupposes that the 
length is from the stem's natural starting point instead of from the stem's 
natural ending point.

Currently, the stem stencil function is doable in Scheme, which means that the 
result from 2.15.8 can be achieved via :

#(define (my-stem grob)
  (let*
    ((dir (ly:grob-property grob 'direction))
     (half-space (* 0.5 (ly:staff-symbol-staff-space grob)))
     (y1 (* half-space (ly:stem::calc-stem-begin-position grob)))
     (y2 (* half-space (ly:stem::calc-stem-end-position grob)))
     (half-thick (* (* (ly:grob-property grob 'thickness)
                       (ly:staff-symbol-line-thickness grob))
                    0.5))
     (beam (ly:grob-object grob 'beam))
     (y2 (+ y2 (if (null? beam)
                   0.0
                   (* dir (* (ly:grob-property beam
                                               'beam-thickness)
                             half-space)))))
     (my-down (if (< y2 y1) y2 y1))
     (my-up (if (< y2 y1) y1 y2))
     (blot (ly:paper-get-number (ly:grob-layout grob) 'blot-diameter)))
   (ly:make-stencil `(round-filled-box ,half-thick
                                       ,half-thick
                                       ,(- my-down)
                                       ,my-up
                                       ,blot)
                    (cons (- half-thick) half-thick)
                    (cons my-down my-up))))

{
 c''_\fermata
 \override Stem #'Y-extent = #'(-10 . 0)
 \override Stem #'stencil = #my-stem
 c''_\fermata
}

I'm not sure of a good way to deal with this from a UI perspective, but at 
least the function above allows you to achieve the result you're talking about 
with only one extra override

Cheers,
MS


reply via email to

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