]> git.donarmstrong.com Git - lilypond.git/blob - ly/property-init.ly
New engraver for braces.
[lilypond.git] / ly / property-init.ly
1 % property-init.ly
2
3 \version "2.14.0"
4
5 %% for dashed slurs, phrasing slurs, and ties
6 #(define (make-simple-dash-definition dash-fraction dash-period)
7     (list (list 0 1 dash-fraction dash-period)))
8
9 %% common definition for all note head styles reverting
10 %% (palm mute, harmonics, dead notes, ...)
11 defaultNoteHeads =
12 #(define-music-function (parser location) ()
13    (_i "Revert to the default note head style.")
14    (revert-head-style '(NoteHead TabNoteHead)))
15
16
17
18 %% arpeggios
19
20 % For drawing vertical chord brackets with \arpeggio
21 % This is a shorthand for the value of the print-function property
22 % of either Staff.Arpeggio or PianoStaff.Arpeggio, depending whether
23 % cross-staff brackets are desired.
24
25 arpeggio = #(make-music 'ArpeggioEvent)
26 brace = #(make-music 'BraceEvent)
27
28 arpeggioArrowUp = {
29   \revert Arpeggio  #'stencil
30   \revert Arpeggio #'X-extent
31   \override Arpeggio  #'arpeggio-direction = #UP
32 }
33 arpeggioArrowDown = {
34   \revert Arpeggio #'stencil
35   \revert Arpeggio #'X-extent
36   \override Arpeggio  #'arpeggio-direction = #DOWN
37 }
38 arpeggioNormal = {
39   \revert Arpeggio #'stencil
40   \revert Arpeggio #'X-extent
41   \revert Arpeggio #'arpeggio-direction
42   \revert Arpeggio #'dash-definition
43 }
44 arpeggioBracket = {
45   \revert Arpeggio #'X-extent
46   \override Arpeggio #'stencil = #ly:arpeggio::brew-chord-bracket
47 }
48 arpeggioParenthesis = {
49   \override Arpeggio #'stencil = #ly:arpeggio::brew-chord-slur
50   \override Arpeggio #'X-extent = #ly:grob::stencil-width
51   \revert Arpeggio #'dash-definition
52 }
53 arpeggioParenthesisDashed = {
54   \override Arpeggio #'stencil = #ly:arpeggio::brew-chord-slur
55   \override Arpeggio #'X-extent = #ly:grob::stencil-width
56   \override Arpeggio #'dash-definition = #'((0 1 0.4 0.75))
57 }
58
59
60 %% auto beaming
61
62 autoBeamOn  = \set autoBeaming = ##t
63 autoBeamOff = \set autoBeaming = ##f
64
65
66 %% balloon length
67
68 balloonLengthOn = {
69   \override BalloonTextItem #'extra-spacing-width = #'(0 . 0)
70   \override BalloonTextItem #'extra-spacing-height = #'(-inf.0 . +inf.0)
71 }
72 balloonLengthOff = {
73   \override BalloonTextItem #'extra-spacing-width = #'(+inf.0 . -inf.0)
74   \override BalloonTextItem #'extra-spacing-height = #'(0 . 0)
75 }
76
77
78 %% bass figures
79
80 bassFigureExtendersOn = {
81   \set useBassFigureExtenders = ##t
82   \set Staff.useBassFigureExtenders = ##t
83 }
84 bassFigureExtendersOff = {
85   \set useBassFigureExtenders = ##f
86   \set Staff.useBassFigureExtenders = ##f
87 }
88 bassFigureStaffAlignmentDown =
89   \override Staff.BassFigureAlignmentPositioning #'direction = #DOWN
90 bassFigureStaffAlignmentUp =
91   \override Staff.BassFigureAlignmentPositioning #'direction = #UP
92 bassFigureStaffAlignmentNeutral =
93   \revert Staff.BassFigureAlignmentPositioning #'direction
94
95
96 %% cadenzas
97
98 cadenzaOn  = {
99   \set Timing.timing = ##f
100   \set Timing.autoBeaming = ##f
101 }
102
103 cadenzaOff = {
104   \set Timing.timing = ##t
105   \set Timing.measurePosition = #ZERO-MOMENT
106   \set Timing.autoBeaming = ##t
107 }
108
109
110 %% chord names
111
112 frenchChords = {
113   \set chordRootNamer = #(chord-name->italian-markup #t)
114   \set chordPrefixSpacer = #0.4
115 }
116 germanChords = {
117   \set chordRootNamer = #(chord-name->german-markup #t)
118   \set chordNoteNamer = #note-name->german-markup
119 }
120 semiGermanChords = {
121   \set chordRootNamer = #(chord-name->german-markup #f)
122   \set chordNoteNamer = #note-name->german-markup
123 }
124 italianChords = {
125   \set chordRootNamer = #(chord-name->italian-markup #f)
126   \set chordPrefixSpacer = #0.4
127 }
128 powerChords = {
129   \set chordNameExceptions = #powerChordExceptions
130 }
131
132
133 %% compressFullBarRests
134
135 compressFullBarRests = \set Score.skipBars = ##t
136 expandFullBarRests   = \set Score.skipBars = ##f
137
138
139 %% dots
140
141 dotsUp      = \override Dots #'direction = #UP
142 dotsDown    = \override Dots #'direction = #DOWN
143 dotsNeutral = \revert Dots #'direction
144
145
146 %% dynamics
147
148 dynamicUp = {
149   \override DynamicText #'direction = #UP
150   \override DynamicLineSpanner #'direction = #UP
151 }
152 dynamicDown = {
153   \override DynamicText #'direction = #DOWN
154   \override DynamicLineSpanner #'direction = #DOWN
155 }
156 dynamicNeutral = {
157   \revert DynamicText #'direction
158   \revert DynamicLineSpanner #'direction
159 }
160
161
162 %% easy heads
163
164 easyHeadsOn = {
165   \override NoteHead #'stencil = #note-head::brew-ez-stencil
166   \override NoteHead #'font-size = #-8
167   \override NoteHead #'font-family = #'sans
168   \override NoteHead #'font-series = #'bold
169 }
170 easyHeadsOff = {
171   \revert NoteHead #'stencil
172   \revert NoteHead #'font-size
173   \revert NoteHead #'font-family
174   \revert NoteHead #'font-series
175 }
176
177
178 %% endincipit
179
180 %% End the incipit and print a ``normal line start''.
181 endincipit = \context Staff {
182   \partial 16 s16  % Hack to handle e.g. \bar ".|" \endincipit
183   \once \override Staff.Clef #'full-size-change = ##t
184   \once \override Staff.Clef #'non-default = ##t
185   \bar ""
186 }
187
188
189 %% fermata markup
190
191 fermataMarkup =
192 #(make-music 'MultiMeasureTextEvent
193              'tweaks (list
194                       ;; Set the 'text based on the 'direction
195                       (cons 'text (lambda (grob)
196                                     (if (eq? (ly:grob-property grob 'direction) DOWN)
197                                         (markup #:musicglyph "scripts.dfermata")
198                                         (markup #:musicglyph "scripts.ufermata"))))
199                       (cons 'outside-staff-priority 40)
200                       (cons 'outside-staff-padding 0)))
201
202 %% font sizes
203
204 teeny      = \set fontSize = #-3
205 tiny       = \set fontSize = #-2
206 small      = \set fontSize = #-1
207 normalsize = \set fontSize = #0
208 large      = \set fontSize = #1
209 huge       = \set fontSize = #2
210
211
212 %% glissando
213
214 glissando = #(make-music 'GlissandoEvent)
215
216
217 %% harmonics
218
219 harmonicsOn =
220 #(define-music-function (parser location) ()
221    (_i "Set the default note head style to a diamond-shaped style.")
222    (override-head-style '(NoteHead TabNoteHead) 'harmonic))
223 harmonicsOff = \defaultNoteHeads
224 harmonicNote =
225 #(define-music-function (parser location note) (ly:music?)
226    (_i "Print @var{note} with a diamond-shaped note head.")
227    (style-note-heads 'NoteHead 'harmonic note))
228
229
230 %% hideNotes
231
232 hideNotes = {
233   % hide notes, accidentals, etc.
234   \override Dots #'transparent = ##t
235   \override NoteHead #'transparent = ##t
236   \override NoteHead #'no-ledgers = ##t
237   \override Stem #'transparent = ##t
238   \override Beam #'transparent = ##t
239   \override Accidental #'transparent = ##t
240 }
241 unHideNotes = {
242   \revert Accidental #'transparent
243   \revert Beam #'transparent
244   \revert Stem #'transparent
245   \revert NoteHead #'transparent
246   \revert NoteHead #'no-ledgers
247   \revert Dots #'transparent
248 }
249
250
251 %% improvisation
252
253 improvisationOn = {
254   \set squashedPosition = #0
255   \override NoteHead #'style = #'slash
256   \override Accidental #'stencil = ##f
257   \override AccidentalCautionary #'stencil = ##f
258 }
259 improvisationOff = {
260   \unset squashedPosition
261   \revert NoteHead #'style
262   \revert Accidental #'stencil
263   \revert AccidentalCautionary #'stencil
264 }
265
266
267 %% merging
268
269 mergeDifferentlyDottedOn =
270   \override Staff.NoteCollision #'merge-differently-dotted = ##t
271 mergeDifferentlyDottedOff =
272   \revert Staff.NoteCollision #'merge-differently-dotted
273 mergeDifferentlyHeadedOn =
274   \override Staff.NoteCollision #'merge-differently-headed = ##t
275 mergeDifferentlyHeadedOff =
276   \revert Staff.NoteCollision #'merge-differently-headed
277
278
279 %% numeric time signature
280
281 numericTimeSignature = \override Staff.TimeSignature #'style = #'numbered
282 defaultTimeSignature = \revert Staff.TimeSignature #'style
283
284
285 %% palm mutes
286
287 palmMuteOn =
288 #(define-music-function (parser location) ()
289    (_i "Set the default note head style to a triangle-shaped style.")
290    (override-head-style 'NoteHead 'do))
291 palmMuteOff = \defaultNoteHeads
292 palmMute =
293 #(define-music-function (parser location note) (ly:music?)
294    (_i "Print @var{note} with a triangle-shaped note head.")
295    (style-note-heads 'NoteHead 'do note))
296
297
298 %% phrasing slurs
299
300 % directions
301 phrasingSlurUp      = \override PhrasingSlur #'direction = #UP
302 phrasingSlurDown    = \override PhrasingSlur #'direction = #DOWN
303 phrasingSlurNeutral = \revert PhrasingSlur #'direction
304
305 % dash-patterns (make-simple-dash-definition defined at top of file)
306 phrasingSlurDashPattern =
307 #(define-music-function (parser location dash-fraction dash-period)
308    (number? number?)
309    (_i "Set up a custom style of dash pattern for @var{dash-fraction} ratio of
310 line to space repeated at @var{dash-period} interval.")
311   #{
312      \override PhrasingSlur #'dash-definition =
313        $(make-simple-dash-definition dash-fraction dash-period)
314   #})
315 phrasingSlurDashed =
316   \override PhrasingSlur #'dash-definition = #'((0 1 0.4 0.75))
317 phrasingSlurDotted =
318   \override PhrasingSlur #'dash-definition = #'((0 1 0.1 0.75))
319 phrasingSlurHalfDashed =
320   \override PhrasingSlur #'dash-definition = #'((0 0.5 0.4 0.75)
321                                                 (0.5 1 1 1))
322 phrasingSlurHalfSolid =
323   \override PhrasingSlur #'dash-definition = #'((0 0.5 1 1)
324                                                 (0.5 1 0.4 0.75))
325 phrasingSlurSolid =
326   \revert PhrasingSlur #'dash-definition
327
328
329 %% point and click
330
331 pointAndClickOn  =
332 #(define-music-function (parser location) ()
333    (_i "Enable generation of code in final-format (e.g. pdf) files to reference the
334 originating lilypond source statement;
335 this is helpful when developing a score but generates bigger final-format files.")
336    (ly:set-option 'point-and-click #t)
337    (make-music 'SequentialMusic 'void #t))
338
339 pointAndClickOff =
340 #(define-music-function (parser location) ()
341    (_i "Suppress generating extra code in final-format (e.g. pdf) files to point
342 back to the lilypond source statement.")
343    (ly:set-option 'point-and-click #f)
344    (make-music 'SequentialMusic 'void #t))
345
346
347 %% predefined fretboards
348
349 predefinedFretboardsOff =
350   \set predefinedDiagramTable = ##f
351 predefinedFretboardsOn =
352   \set predefinedDiagramTable = #default-fret-table
353
354
355 %% shape note heads
356
357 aikenHeads      = \set shapeNoteStyles = #'#(do re miMirror fa sol la ti)
358 aikenHeadsMinor = \set shapeNoteStyles = #'#(la ti do re miMirror fa sol)
359 funkHeads =
360   \set shapeNoteStyles = #'#(doFunk reFunk miFunk faFunk solFunk laFunk tiFunk)
361 funkHeadsMinor =
362   \set shapeNoteStyles = #'#(laFunk tiFunk doFunk reFunk miFunk faFunk solFunk)
363 sacredHarpHeads = \set shapeNoteStyles = #'#(fa sol la fa sol la mi)
364 sacredHarpHeadsMinor = \set shapeNoteStyles = #'#(la mi fa sol la fa sol)
365 southernHarmonyHeads =
366   \set shapeNoteStyles = #'#(faThin sol laThin faThin sol laThin miThin)
367 southernHarmonyHeadsMinor =
368   \set shapeNoteStyles = #'#(laThin miThin faThin sol laThin faThin sol)
369 walkerHeads =
370   \set shapeNoteStyles = #'#(doWalker reWalker miWalker faWalker solFunk laWalker tiWalker)
371 walkerHeadsMinor =
372   \set shapeNoteStyles = #'#(laWalker tiWalker doWalker reWalker miWalker faWalker solFunk)
373
374
375 %% shifts
376
377 shiftOn   = \override NoteColumn #'horizontal-shift = #1
378 shiftOnn  = \override NoteColumn #'horizontal-shift = #2
379 shiftOnnn = \override NoteColumn #'horizontal-shift = #3
380 shiftOff  = \revert NoteColumn #'horizontal-shift
381
382
383 %% slurs
384
385 % directions
386 slurUp         = \override Slur #'direction = #UP
387 slurDown       = \override Slur #'direction = #DOWN
388 slurNeutral    = \revert Slur #'direction
389
390 % dash-patterns (make-simple-dash-definition defined at top of file)
391 slurDashPattern =
392 #(define-music-function (parser location dash-fraction dash-period)
393   (number? number?)
394   #{
395      \override Slur #'dash-definition =
396        $(make-simple-dash-definition dash-fraction dash-period)
397   #})
398 slurDashed     = \override Slur #'dash-definition = #'((0 1 0.4 0.75))
399 slurDotted     = \override Slur #'dash-definition = #'((0 1 0.1 0.75))
400 slurHalfDashed = \override Slur #'dash-definition = #'((0 0.5 0.4 0.75)
401                                                        (0.5 1 1 1))
402 slurHalfSolid  = \override Slur #'dash-definition = #'((0 0.5 1 1)
403                                                        (0.5 1 0.4 0.75))
404 slurSolid      = \revert Slur #'dash-definition
405
406
407 %% staff switches
408
409 showStaffSwitch = \set followVoice = ##t
410 hideStaffSwitch = \set followVoice = ##f
411
412
413 %% stems
414
415 stemUp      = \override Stem #'direction = #UP
416 stemDown    = \override Stem #'direction = #DOWN
417 stemNeutral = \revert Stem #'direction
418
419
420 %% tablature
421
422 % switch to full notation
423 tabFullNotation = {
424   % time signature
425   \revert TabStaff.TimeSignature #'stencil
426   % stems (the half note gets a double stem)
427   \revert TabVoice.Stem #'length
428   \revert TabVoice.Stem #'no-stem-extend
429   \revert TabVoice.Stem #'flag-style
430   \revert TabVoice.Stem #'details
431   \revert TabVoice.Stem #'transparent
432   \override TabVoice.Stem #'stencil = #tabvoice::draw-double-stem-for-half-notes
433   \set autoBeaming = ##t
434   \revert NoteColumn #'ignore-collision
435   % beams, dots
436   \revert TabVoice.Beam #'stencil
437   \revert TabVoice.StemTremolo #'stencil
438   \revert TabVoice.Dots #'stencil
439   \revert TabVoice.Tie #'stencil
440   \revert TabVoice.Tie #'after-line-breaking
441   \revert TabVoice.RepeatTie #'stencil
442   \revert TabVoice.RepeatTie #'after-line-breaking
443   \revert TabVoice.LaissezVibrerTie #'stencil
444   \revert TabVoice.Slur #'stencil
445   \revert TabVoice.PhrasingSlur #'stencil
446   % tuplet stuff
447   \revert TabVoice.TupletBracket #'stencil
448   \revert TabVoice.TupletNumber #'stencil
449   % dynamic signs
450   \revert TabVoice.DynamicText #'transparent
451   \revert TabVoice.DynamicTextSpanner #'stencil
452   \revert TabVoice.DynamicTextSpanner #'stencil
453   \revert TabVoice.Hairpin #'transparent
454   % rests
455   \revert TabVoice.Rest #'stencil
456   \revert TabVoice.MultiMeasureRest #'stencil
457   \revert TabVoice.MultiMeasureRestNumber #'transparent
458   \revert TabVoice.MultiMeasureRestText #'transparent
459   % markups etc.
460   \revert TabVoice.Glissando #'stencil
461   \revert TabVoice.Script #'stencil
462   \revert TabVoice.TextScript #'stencil
463   \revert TabVoice.TextSpanner #'stencil
464   \revert TabStaff.Arpeggio #'stencil
465   \revert TabStaff.NoteColumn #'ignore-collision
466 }
467
468 %tie/repeat tie behaviour
469 hideSplitTiedTabNotes = {
470   \override TabVoice.TabNoteHead #'(details tied-properties break-visibility) = #all-invisible
471   \override TabVoice.TabNoteHead #'(details tied-properties parenthesize) = ##f
472   \override TabVoice.TabNoteHead #'(details repeat-tied-properties note-head-visible) = ##f
473   \override TabVoice.TabNoteHead #'(details repeat-tied-properties parenthesize) = ##f
474 }
475
476 showSplitTiedTabNotes = {
477   \override TabVoice.TabNoteHead #'(details tied-properties break-visibility) = #begin-of-line-visible
478   \override TabVoice.TabNoteHead #'(details tied-properties parenthesize) = ##t
479   \override TabVoice.TabNoteHead #'(details repeat-tied-properties note-head-visible) = ##t
480   \override TabVoice.TabNoteHead #'(details repeat-tied-properties parenthesize) = ##t
481 }
482
483 %% text length
484
485 textLengthOn = {
486   \override TextScript #'extra-spacing-width = #'(0 . 0)
487   \override TextScript #'extra-spacing-height = #'(-inf.0 . +inf.0)
488 }
489 textLengthOff = {
490   \override TextScript #'extra-spacing-width = #'(+inf.0 . -inf.0)
491   \override TextScript #'extra-spacing-height = #'(0 . 0)
492 }
493
494
495 %% text spanners
496
497 textSpannerUp      = \override TextSpanner #'direction = #UP
498 textSpannerDown    = \override TextSpanner #'direction = #DOWN
499 textSpannerNeutral = \revert TextSpanner #'direction
500
501
502 %% ties
503
504 % directions
505 tieUp      = \override Tie #'direction = #UP
506 tieDown    = \override Tie #'direction = #DOWN
507 tieNeutral = \revert Tie #'direction
508
509 % dash-patterns (make-simple-dash-definition defined at top of file)
510 tieDashPattern =
511 #(define-music-function (parser location dash-fraction dash-period)
512   (number? number?)
513   #{
514      \override Tie #'dash-definition =
515        $(make-simple-dash-definition dash-fraction dash-period)
516   #})
517 tieDashed     = \override Tie #'dash-definition = #'((0 1 0.4 0.75))
518 tieDotted     = \override Tie #'dash-definition = #'((0 1 0.1 0.75))
519 tieHalfDashed = \override Tie #'dash-definition = #'((0 0.5 0.4 0.75)
520                                                      (0.5 1 1 1))
521 tieHalfSolid  = \override Tie #'dash-definition = #'((0 0.5 1 1)
522                                                      (0.5 1 0.4 0.75))
523 tieSolid      = \revert Tie #'dash-definition
524
525
526 %% tuplets
527
528 tupletUp      = \override TupletBracket #'direction = #UP
529 tupletDown    = \override TupletBracket #'direction = #DOWN
530 tupletNeutral = \revert TupletBracket #'direction
531
532
533 %% voice properties
534
535 % dynamic ly:dir?  text script, articulation script ly:dir?
536 voiceOne   = #(context-spec-music (make-voice-props-set 0)  'Voice)
537 voiceTwo   = #(context-spec-music (make-voice-props-set 1)  'Voice)
538 voiceThree = #(context-spec-music (make-voice-props-set 2)  'Voice)
539 voiceFour  = #(context-spec-music (make-voice-props-set 3)  'Voice)
540 oneVoice   = #(context-spec-music (make-voice-props-revert) 'Voice)
541
542
543 %% voice styles
544
545 voiceOneStyle = {
546   \override NoteHead #'style = #'diamond
547   \override NoteHead #'color = #red
548   \override Stem #'color = #red
549   \override Beam #'color = #red
550 }
551 voiceTwoStyle = {
552   \override NoteHead #'style = #'triangle
553   \override NoteHead #'color = #blue
554   \override Stem #'color = #blue
555   \override Beam #'color = #blue
556 }
557 voiceThreeStyle = {
558   \override NoteHead #'style = #'xcircle
559   \override NoteHead #'color = #green
560   \override Stem #'color = #green
561   \override Beam #'color = #green
562 }
563 voiceFourStyle = {
564   \override NoteHead #'style = #'cross
565   \override NoteHead #'color = #magenta
566   \override Stem #'color = #magenta
567   \override Beam #'color = #magenta
568 }
569 voiceNeutralStyle = {
570   \revert NoteHead #'style
571   \revert NoteHead #'color
572   \revert Stem #'color
573   \revert Beam #'color
574 }
575
576
577 %% x notes
578
579 xNotesOn =
580 #(define-music-function (parser location) ()
581    (_i "Set the default note head style to a cross-shaped style.")
582    (override-head-style '(TabNoteHead NoteHead) 'cross))
583 xNotesOff = \defaultNoteHeads
584 xNote =
585 #(define-music-function (parser location note) (ly:music?)
586    (_i "Print @var{note} with a cross-shaped note head.")
587    (style-note-heads '(TabNoteHead NoteHead) 'cross note))
588
589
590 %% dead notes (these need to come after "x notes")
591
592 % Define aliases of cross-head notes for specific purposes
593 deadNotesOn  = \xNotesOn
594 deadNotesOff = \xNotesOff
595 deadNote     = #xNote