lilypond-user
[Top][All Lists]
Advanced

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

Re: Dashed Stem Fontsize !


From: Ya Gloops
Subject: Re: Dashed Stem Fontsize !
Date: Sat, 23 Jul 2022 17:43:01 +0000 (UTC)

Thank you very much for your help Harm !!!
Gilles






Le vendredi 22 juillet 2022 à 19:27:50 UTC+2, Thomas Morley 
<thomasmorley65@gmail.com> a écrit : 





Am Fr., 22. Juli 2022 um 13:04 Uhr schrieb Ya Gloops <yagloops@yahoo.fr>:
>
>
> Hello ! I try to keep the proportion of the "dashed-stem" but I can't... If 
> someone can help me.
> Gilles
>
> \version "2.23.10"
>
>
> %#(set-global-staff-size 30)
>
>
> #(define (make-round-filled-box x1 x2 y1 y2 blot-diameter)
>    (ly:make-stencil (list 'round-filled-box (- x1) x2 (- y1) y2 blot-diameter)
>      (cons x1 x2)
>      (cons y1 y2)))
>
>
> #(define (build-pos-list len on off)
>    (let ((lst '(0)))
>
>      (define (helper)
>        (let ((bottom (+ (car lst) on)))
>          (if (< bottom len)
>              (begin
>              (set! lst (cons bottom lst))
>              (let ((top (+ (car lst) off)))
>                (if (< top len)
>                    (begin
>                      (set! lst (cons top lst))
>                      (helper))
>                    (set! lst (cons len lst)))))
>              (set! lst (cons len lst)))))
>      (helper)
>      (reverse lst)))
>
>
> #(define (dashed-stem on off)
>    (lambda (grob)
>      (let* ((blot (ly:output-def-lookup (ly:grob-layout grob) 'blot-diameter))
>            (stencil (ly:stem::print grob))
>            (X-ext (ly:stencil-extent stencil X))
>            (thickness (interval-length X-ext))
>            (Y-ext (ly:stencil-extent stencil Y))
>            (len (interval-length Y-ext))
>            (new-stencil empty-stencil)
>            (factors (build-pos-list len on off)))
>
>        (define (helper args)
>          (if (<= 2 (length args))
>              (begin
>              (set! new-stencil
>                    (ly:stencil-add
>                      new-stencil
>                      (ly:stencil-translate-axis
>                      (make-round-filled-box (/ thickness -2) (/ thickness 2)
>                        (car args) (cadr args)
>                        blot)
>                      (interval-start Y-ext)
>                      Y)))
>              (helper (cddr args)))
>              new-stencil))
>
>
>        (if (or (zero? on) (zero? off))
>            stencil
>            (helper factors)))))
>
>
> dashedStems =
> #(define-music-function (on off) (number? number?)
>    #{
>      \override Stem.stencil = #(dashed-stem on off)
>    #})
>
>
>
>
> \relative c'' {
>  \dashedStems #0.5 #0.4
>  c4
> }
>
>
> \score
> {
>  \relative c'' { \magnifyStaff #(magstep 10)
>                  \dashedStems #0.5 #0.4
>                  c4
>  }
> }
>

Scale on/off with staff-space, (ly:staff-symbol-staff-space grob).

HTH,
  Harm



reply via email to

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