X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=input%2Fregression%2Fflags-in-scheme.ly;h=d18c1bef2dfc3d8244d2f52ed1542d55b48087ff;hb=13da8b27aabc5d5a752d00ed1e2b99ad20f0f264;hp=5d9238a1cedcf0282e56f39fa2fcddfdef917c91;hpb=1e9b3a12dfaa81f718a5b5d203161be8ca732013;p=lilypond.git diff --git a/input/regression/flags-in-scheme.ly b/input/regression/flags-in-scheme.ly index 5d9238a1ce..d18c1bef2d 100644 --- a/input/regression/flags-in-scheme.ly +++ b/input/regression/flags-in-scheme.ly @@ -1,7 +1,7 @@ -\version "2.11.57" +\version "2.17.6" \header { - texidoc = "The 'flag property of the Stem grob can be set to a custom + texidoc = "The 'stencil property of the Flag grob can be set to a custom scheme function to generate the glyph for the flag." } @@ -9,34 +9,40 @@ scheme function to generate the glyph for the flag." % test notes, which will be shown in different style: testnotes = { \autoBeamOff c'8 d'16 c'32 d'64 \acciaccatura {c'8} d'64 c''8 d''16 c''32 d''64 \acciaccatura {c''8} d''64 } -#(define-public (weight-flag stem-grob) - (let* ((log (- (ly:grob-property stem-grob 'duration-log) 2)) +#(define-public (weight-flag grob) + (let* ((stem-grob (ly:grob-parent grob X)) + (log (- (ly:grob-property stem-grob 'duration-log) 2)) (is-up (eqv? (ly:grob-property stem-grob 'direction) UP)) (yext (if is-up (cons (* log -0.8) 0) (cons 0 (* log 0.8)))) (flag-stencil (make-filled-box-stencil '(-0.4 . 0.4) yext)) - (stroke-style (ly:grob-property stem-grob 'stroke-style)) + (stroke-style (ly:grob-property grob 'stroke-style)) (stroke-stencil (if (equal? stroke-style "grace") (make-line-stencil 0.2 -0.9 -0.4 0.9 -0.4) empty-stencil))) (ly:stencil-add flag-stencil stroke-stencil))) % Create a flag stencil by looking up the glyph from the font -#(define (inverted-flag stem-grob) - (let* ((dir (if (eqv? (ly:grob-property stem-grob 'direction) UP) "d" "u")) - (flag (retrieve-glyph-flag "" dir "" stem-grob)) - (stroke-style (ly:grob-property stem-grob 'stroke-style)) +#(define (inverted-flag grob) + (let* ((stem-grob (ly:grob-parent grob X)) + (dir (if (eqv? (ly:grob-property stem-grob 'direction) UP) "d" "u")) + (flag (retrieve-glyph-flag "" dir "" grob)) + (line-thickness (ly:staff-symbol-line-thickness grob)) + (stem-thickness (ly:grob-property stem-grob 'thickness)) + (stem-width (* line-thickness stem-thickness)) + (stroke-style (ly:grob-property grob 'stroke-style)) (stencil (if (null? stroke-style) flag - (add-stroke-glyph flag stem-grob dir stroke-style "")))) - (ly:stencil-rotate-absolute stencil 180 0 0))) + (add-stroke-glyph flag grob dir stroke-style ""))) + (rotated-flag (ly:stencil-rotate-absolute stencil 180 0 0))) + (ly:stencil-translate rotated-flag (cons (- (/ stem-width 2)) 0)))) { - \override Score.RehearsalMark #'self-alignment-X = #LEFT + \override Score.RehearsalMark.self-alignment-X = #LEFT \time 2/4 \mark "Function: weight-flag (custom)" - \override Stem #'flag = #weight-flag + \override Flag.stencil = #weight-flag \testnotes \mark "Function: inverted-flag (custom)" - \override Stem #'flag = #inverted-flag + \override Flag.stencil = #inverted-flag \testnotes }