syllabify : prise en compte langues sans espace insécable avant les
[nenuvar.git] / common / layout.ily
blob0dc7522ad2e64eeda92bfd5bfbafcc82569fcf58
1 %%% layout.ily
2 %%%
3 %%% Author: Nicolas Sceaux <nicolas.sceaux@free.fr>
4 %%%
5 %% Paper size
6 #(define-public *paper-size* (make-parameter 'a4))
8 %%% Paper size options:
9 %%% letter: Letter book option
10 %%% hardcover: Hardcover 210x273 book option
11 %%% otherwise: A4
13 #(set! paper-alist
14    (cons '("hardcover" . (cons (* 209.55 mm) (* 273.1 mm)))
15          paper-alist))
17 #(cond ((ly:get-option 'letter) (*paper-size* 'letter))
18        ((ly:get-option 'hardcover) (*paper-size* 'hardcover))
19        (else (*paper-size* 'a4)))
21 #(set-default-paper-size (symbol->string (*paper-size*)))
23 #(ly:set-option 'point-and-click #f)
25 \paper {
26   %% Margins, line width
27   two-sided = ##t
28   inner-margin = 15\mm
29   outer-margin = 10\mm
30   #(define line-width (- paper-width (* 25 mm)))
32   ragged-bottom = ##f
33   ragged-last-bottom = ##f
36 \layout {
37   #(define (compute-indent amount)
38     (let ((indent (* amount mm)))
39       (if (or (eqv? #t (ly:get-option 'ancient-style))
40               (eqv? #t (ly:get-option 'non-incipit)))
41           (begin ;(format #t "~% indent: ~a" indent)
42            indent)
43           (+ indent (* incipit-width mm)))))
45   smallindent = #(compute-indent 10)
46   noindent = #(compute-indent 0)
47   largeindent = #(compute-indent 25)
48   hugeindent = #(compute-indent 35)
49   indent = \smallindent
51   \context {
52     \Score
53     \name Score
54     \override BarNumber #'padding = #2 
55     \override InstrumentName #'font-size = #1.0
56     \override InstrumentName #'space-alist = #'((left-edge extra-space . 2.0))
57     \accepts "StaffGroupNoBar"
58     skipBars = ##t
59     %% By default, no annotation line for footnotes
60     \override FootnoteItem #'annotation-line = ##f
61   }
62   \context {
63     \StaffGroup
64     \name StaffGroup
65     \accepts "StaffGroupNoBracket"
66   }
67   \context {
68     \StaffGroup
69     \name StaffGroupNoBar
70     \description "Like StaffGroup, but without spanbar"
71     \remove "Span_bar_engraver"
72     \accepts "StaffGroupNoBracket"
73     \accepts "InnerStaffGroup"
74     \accepts "InnerChoirStaff"
75   }
76   \context {
77     \StaffGroup
78     \name StaffGroupNoBracket
79     \description "Like StaffGroup, but without brackets"
80     \remove "System_start_delimiter_engraver"
81   }
82   \context {
83     \ChoirStaff
84     \consists "Instrument_name_engraver"
85   }
86   \context {
87     \Staff
88     \name Staff
89     \override VerticalAxisGroup #'minimum-Y-extent = #'(-4 . 4)
90     %% ancient-style: no time signature or key signature
91     %% at an end of line.
92     \override TimeSignature #'break-visibility =
93     #(if (eqv? #t (ly:get-option 'ancient-style))
94          end-of-line-invisible
95          all-visible)
96     explicitKeySignatureVisibility =
97     #(if (eqv? #t (ly:get-option 'ancient-style))
98          end-of-line-invisible
99          all-visible)
100     explicitClefVisibility =
101     #(if (eqv? #t (ly:get-option 'ancient-style))
102          end-of-line-invisible
103          all-visible)
104     %% Figured bass
105     ignoreFiguredBassRest = ##f
106     figuredBassAlterationDirection = #RIGHT
107     \override BassFigureAlignment #'stacking-dir = #UP
108     \override BassFigureAlignmentPositioning #'direction = #DOWN
109   }
110   \context {
111     \FiguredBass
112     \name FiguredBass
113     %% Give Figured Bass an horizontal extent so that RehearsalMarks
114     %% do not ignore it (otherwise, marks would be place between staff
115     %% and figured bass)
116     \override BassFigureAlignment #'X-extent = #'(0 . 0)
117   }
118   RemoveEmptyStaffContext = \context {
119     \Staff
120     \override VerticalAxisGroup #'remove-empty = ##t
121     \override VerticalAxisGroup #'minimum-Y-extent = #'(-4 . 4)
122   }
123   \context {
124     \Staff
125     \name SmallStaff
126     \description "Staff with small notes"
127     fontSize = #-2
128     \override StaffSymbol #'staff-space = #(magstep -2)
129   }
130   \context {
131     \PianoStaff
132     \name PianoStaff
133     \override StaffGrouper #'staff-staff-spacing #'stretchability = #1
134   }
135   \context {
136     \Voice
137     \name Voice
138     \override Script #'avoid-slur = #'outside
139     \override NoteHead.style = #'baroque
140   }
141   \context {
142     \CueVoice
143     \name CueVoice
144     \override Script #'avoid-slur = #'outside
145   }
148 %% override beaming behavior
149 %% in 2/2, group 16th notes by 4 (not by 8)
150 #(define-public (add-beam-exception time-signature beam-exception settings)
151    (assoc-set! settings
152                time-signature
153                (assoc-set!
154                 (assoc-get time-signature settings '())
155                 'beamExceptions
156                 (cons beam-exception
157                       (beam-exceptions time-signature settings)))))
158 #(set! default-time-signature-settings
159        (add-beam-exception
160         '(2 . 2) '(end ((1 . 16) 4 4 4 4))
161         default-time-signature-settings))
163 pageBreakCond =
164 #(define-music-function (location parser paper-sizes) (list?)
165    (if (memq (*paper-size*) paper-sizes)
166        (make-music 'EventChord
167          'page-marker #t
168          'line-break-permission 'force
169          'page-break-permission 'force
170          'elements (list (make-music 'LineBreakEvent
171                            'break-permission 'force)
172                          (make-music 'PageBreakEvent
173                            'break-permission 'force)))
174        (make-music 'Music 'void #t)))
176 noPageBreakCond =
177 #(define-music-function (location parser paper-sizes) (list?)
178    (if (memq (*paper-size*) paper-sizes)
179        (make-music 'EventChord
180          'page-marker #t
181          'page-break-permission 'forbid
182          'elements (list (make-music 'PageBreakEvent
183                            'break-permission '())))
184        (make-music 'Music 'void #t)))
186 whenAfour =
187 #(define-music-function (location parser music) (ly:music?)
188    (if (eqv? (*paper-size*) 'a4)
189        music
190        (make-music 'Music 'void #t)))
191 whenLetter =
192 #(define-music-function (location parser music) (ly:music?)
193    (if (eqv? (*paper-size*) 'letter)
194        music
195        (make-music 'Music 'void #t)))