blob: 2e0ffb6a809606ff80db1a8a8f36c91f1085b1a3 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
% DO NOT EDIT this file manually; it is automatically
% generated from Documentation/snippets/new
% Make any changes in Documentation/snippets/new/
% and then run scripts/auxiliar/makelsr.py
%
% This file is in the public domain.
%% Note: this file works from version 2.17.6
\version "2.18.0"
\header {
= "rhythms, tweaks-and-overrides"
= "
The @code{stencil} property of the Flag grob can be set to a custom scheme
function to generate the glyph for the flag.
"
= "Generating custom flags"
} % begin verbatim
#(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 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 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 "")))
(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 }
{
\override Score.RehearsalMark.self-alignment-X = #LEFT
\time 1/4
\mark "Normal flags"
\snippetexamplenotes
\mark "Custom flag: inverted"
\override Flag.stencil = #inverted-flag
\snippetexamplenotes
\mark "Custom flag: weight"
\override Flag.stencil = #weight-flag
\snippetexamplenotes
\mark "Revert to normal"
\revert Flag.stencil
\snippetexamplenotes
}
|