]> git.donarmstrong.com Git - lilypond.git/blob - input/test/pushproperty.ly
release: 1.3.111
[lilypond.git] / input / test / pushproperty.ly
1 \version "1.3.110";
2
3 %{
4
5 Look at ly/engraver.ly for inspiration on which XXXX
6 there are.
7
8 Generally, you can find interesting element properties associated with
9 \property in scm/generic-property.scm. For example, this file contains
10
11         (define generic-stem-properties
12           (cons 'stem-interface
13                 (list
14                  (list 'stemVerticalDirection dir? 'direction)
15                  (list 'verticalDirection dir? 'direction)       
16                  (list 'stemLength number? 'length)
17                  (list 'flagStyle string? 'flag-style)
18         )))
19
20
21 which means that setting \property stemVerticalDirection overrides
22 setting \property verticalDirection, and that both have the effect of
23 setting `direction' in Stem object. You can use \overrideproperty for
24 setting stem directions by doing.
25
26
27         \overrideproperty #'(Stem) #'direction #1
28
29 (#-1 if you want down).  
30
31 A modest amount of memory is involved each time you do a
32 \overrideproperty. If you do \revertproperty in the right order (reversed
33 from \overrideproperty), then \revertproperty doesn't cost memory.
34
35 Correct:
36
37         \overrideproperty #'(  ... ) #'symbolA #valueA
38         \overrideproperty #'(  ... ) #'symbolB #valueB
39         \revertproperty #'(  ... ) #'symbolB 
40         \revertproperty #'(  ... ) #'symbolA 
41
42 Incorrect (\revertproperty costs memory):
43
44         \overrideproperty #'(  ... ) #'symbolA #valueA
45         \overrideproperty #'(  ... ) #'symbolB #valueB
46         \revertproperty #'(  ... ) #'symbolA 
47         \revertproperty #'(  ... ) #'symbolB 
48
49 You can use identifiers, eg.
50
51     slursUp = \context Voice \overrideproperty '(Slur)
52             #'direction  #1
53     slursBoth = \context Voice \revertproperty '(Slur)
54
55 %}
56
57 \score { \notes
58 \relative c' {
59         c4-.(
60         \property Voice.Dots \override #'direction =  #-1
61         \property Voice.Stem \override #'direction =  #-1
62         \property Voice.noteColumnProperties \override #'direction =  #-1
63         \property Voice.Stem \override #'direction =  #-1               
64         
65         ) c4-. (
66         ) c4-. (        
67          \property Voice.Slur \override #'direction =  #-1
68         ) c4-. (
69
70         \property Dots \revert  #'direction
71         \property Stem \revert #'direction
72         \property Script \revert #'direction
73         \property Text \revert #'direction
74
75          ) c4-.  () c4-. 
76 }
77
78 \paper {
79 \translator { \VoiceContext
80         NoteHead \override #'font-relative-size =  #-2
81 }
82 }
83 }