]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/snippets/generating-custom-flags.ly
Docs: run convert-ly for 2.14.0.
[lilypond.git] / Documentation / snippets / generating-custom-flags.ly
index b71bfeb12b2ff7c5477ad4fe7a821ffd41c05608..3668e9d48cc8bc23112ae9fbf0a4f41934d8fee3 100644 (file)
@@ -1,7 +1,10 @@
-%% Do not edit this file; it is automatically
+%% DO NOT EDIT this file manually; it is automatically
 %% generated from LSR http://lsr.dsi.unimi.it
+%% Make any changes in LSR itself, or in Documentation/snippets/new/ ,
+%% and then run scripts/auxiliar/makelsr.py
+%%
 %% This file is in the public domain.
-\version "2.13.31"
+\version "2.14.0"
 
 \header {
   lsrtags = "rhythms, tweaks-and-overrides"
@@ -15,27 +18,30 @@ function to generate the glyph for the flag.
 } % begin verbatim
 
 #(define-public (weight-flag stem-grob)
-  (let* ((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-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)))
+   (let* ((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-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))
-         (line-thickness (ly:staff-symbol-line-thickness stem-grob))
-         (stem-thickness (ly:grob-property stem-grob 'thickness))
-         (stem-width (* line-thickness stem-thickness))
-         (stroke-style (ly:grob-property stem-grob 'stroke-style))
-         (stencil (if (null? stroke-style) flag
-                         (add-stroke-glyph flag stem-grob dir stroke-style "")))
-         (rotated-flag (ly:stencil-rotate-absolute stencil 180 0 0)))
-    (ly:stencil-translate rotated-flag (cons (- (/ stem-width 2))  0))))
+   (let* ((dir (if (eqv? (ly:grob-property stem-grob 'direction) UP) "d" "u"))
+          (flag (retrieve-glyph-flag "" dir "" stem-grob))
+          (line-thickness (ly:staff-symbol-line-thickness stem-grob))
+          (stem-thickness (ly:grob-property stem-grob 'thickness))
+          (stem-width (* line-thickness stem-thickness))
+          (stroke-style (ly:grob-property stem-grob 'stroke-style))
+          (stencil (if (null? stroke-style)
+                       flag
+                       (add-stroke-glyph flag stem-grob dir stroke-style "")))
+          (rotated-flag (ly:stencil-rotate-absolute stencil 180 0 0)))
+     (ly:stencil-translate rotated-flag (cons (- (/ stem-width 2)) 0))))
 
 snippetexamplenotes = { \autoBeamOff c'8 d'16 c'32 d'64 \acciaccatura {c'8} d'64 }
 
@@ -57,3 +63,4 @@ snippetexamplenotes = { \autoBeamOff c'8 d'16 c'32 d'64 \acciaccatura {c'8} d'64
   \revert Stem #'flag
   \snippetexamplenotes
 }
+