[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Dashed Stem Fontsize !
From: |
Ya Gloops |
Subject: |
Dashed Stem Fontsize ! |
Date: |
Fri, 22 Jul 2022 11:03:44 +0000 (UTC) |
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
}
}
- Dashed Stem Fontsize !,
Ya Gloops <=