lilypond-user
[Top][All Lists]
Advanced

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

Re: Override SystemStartSquare width?


From: Thomas Morley
Subject: Re: Override SystemStartSquare width?
Date: Sun, 20 Nov 2016 19:38:51 +0100

2016-11-20 17:22 GMT+01:00 dtsmarin <address@hidden>:
> Many thanks Simon!
> Works really great.



Hi,

although Simons fix works the code below is cheaper and imho more elegant:

#(define* (resize-square x #:optional (y #t))
   "Applies @code{change-width} to the stencil-expression of a grob, which is
supposed to be SystemStartSquare.

@var{x} will resize the length of the horizontal wings.

The optional @var{y} affects the general size in Y-direction, it's default is
@code{#t}:
- SystemStartSquare is off by half staff-line-thickness compared to the staves,
this default may or may not be intended. The default for @var{y} corrects it.
- If set to a number the size is freely customizable.
- If set to false, the size in Y-direction is not touched.

Using this procedure causes the need to reset the padding of the
SystemStartSquare.
"
   (lambda (grob)
     (let* ((default-stil (ly:system-start-delimiter::print grob)))
       (if (grob::is-live? grob)
           (let ((staff-line-thick (ly:staff-symbol-line-thickness grob))
                 (y-corr
                  (cond ((number? y) (- y))
                    ((eq? #t y) (/ staff-line-thick 2))
                    (else 0))))
             ;; n.b.
             ;; the final stencil has the same x- and y-extent as the original
             (ly:make-stencil
               (lists-map
                 (change-width x y-corr) (ly:stencil-expr default-stil))
               (ly:stencil-extent default-stil X)
               (ly:stencil-extent default-stil Y)))
           empty-stencil))))

Cheers,
  Harm



reply via email to

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