]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/ja/notation/changing-defaults.itely
Merge branch 'lilypond/translation'
[lilypond.git] / Documentation / ja / notation / changing-defaults.itely
1 @c -*- coding: utf-8; mode: texinfo; documentlanguage: ja -*-
2
3 @ignore
4     Translation of GIT committish: 45329bd378eedfebca34c746fff9e53b46cf2fe5
5
6     When revising a translation, copy the HEAD committish of the
7     version that you are working on.  For details, see the Contributors'
8     Guide, node Updating translation committishes..
9 @end ignore
10
11 @c \version "2.15.10"
12
13 @c Translators: Yoshiki Sawada
14 @c Translation status: post-GDP
15
16 @node デフォルトを変更する
17 @chapter デフォルトを変更する
18 @translationof Changing defaults
19
20 LilyPond はデフォルトで最高品質の出力を提供できるよう設計されています。@c
21 それにもかかわらず、@c
22 デフォルトのレイアウトを変更する必要が発生する場合もあります。@c
23 レイアウトは、@q{プロパティ} と呼ばれる多数の @q{つまみとスイッチ} によって@c
24 制御されています。@c
25 これらのプロパティにアクセスし、変更するための手引は学習マニュアルの中にあります
26 -- @rlearning{出力を調整する} を参照してください。@c
27 まずはこれを読むべきです。@c
28 本章は同様の内容をカバーしていますが、@c
29 よりリファレンス マニュアルに適したスタイルで提供します。
30
31 @cindex Internals Reference (内部リファレンス)
32
33 調整のために利用できる制御の定義についての説明は、@c
34 別のドキュメントの中にあります: @rinternalsnamed{Top,内部リファレンス} です。@c
35 このマニュアルは利用可能なすべての変数、関数、それにオプションを@c
36 リストアップしています。@c
37 これは HTML ドキュメントとして記述されていて、@c
38 @uref{http://@/lilypond@/.org/@/doc/@/stable/@/Documentation/@/user/@/lilypond@/-internals/,オンライン}
39 で入手可能であり、@c
40 LilyPond ドキュメント パッケージにも含まれています。
41
42 内部的には、LilyPond は Scheme (LISP 派生語) を用いて機能を提供しています。@c
43 レイアウトについての決定をオーバライドすることは、@c
44 プログラムの内部にアクセスすることであり、@c
45 Scheme 入力が必要になります。@c
46 Scheme の要素は、@code{.ly} の中で、@c
47 ハッシュ記号 @code{#} を付けて記述します。@footnote{@rextend{Scheme tutorial}
48 の中に、Scheme 形式で数、リスト、文字列、それに記号を入力するための@c
49 簡単な手引きがあります。}
50
51
52 @menu
53 * コンテキストを理解する::
54 * 内部リファレンスの説明::
55 * プロパティを変更する::
56 * 役に立つコンセプトとプロパティ::
57 * 高度な調整::
58 * 音楽関数を使用する::
59 @end menu
60
61
62 @node コンテキストを理解する
63 @section コンテキストを理解する
64 @translationof Interpretation contexts
65
66 このセクションでは、コンテキストとは何なのか、@c
67 それをどのように変更するのかについて説明します。
68
69 @menu
70 * コンテキストの説明::
71 * コンテキストを作成する::
72 * コンテキストを残しておく::
73 * コンテキストのプラグインを変更する::
74 * コンテキストのデフォルト設定を変更する::
75 * 新しいコンテキストを定義する::
76 * コンテキストを揃える::
77 @end menu
78
79
80 @seealso
81 学習マニュアル:
82 @rlearning{コンテキストとエングラーバ}
83
84 インストール済みファイル:
85 @file{ly/@/engraver@/-init@/.ly},
86 @file{ly/@/performer@/-init@/.ly}
87
88 コード断片集:
89 @rlsr{Contexts and engravers}
90
91 内部リファレンス:
92 @rinternals{Contexts},
93 @rinternals{Engravers and Performers}
94
95
96 @node コンテキストの説明
97 @subsection コンテキストの説明
98 @translationof Contexts explained
99
100 @ignore
101 @c TODO Rethink and rewrite
102
103 >> > > - list of contexts: my *danger unmaintainable*
104 >> > > alarm just went off.  I'm
105
106 I knew it would... And leaving out some of them is perfectly fine
107 with me.
108 I do think that a list like this, with the main contexts and a
109 brief
110 description of  what they do (perhaps also with a note about what
111 default
112 behavior is associated with each of them, but this may be
113 unmanageable),
114 should be there, and then we could simply list the remaining ones
115 without
116 further explanation and with links to the IR.
117 @end ignore
118
119 @c TODO Improve layout, order and consistency of wording -td
120
121 @c TODO Add introduction which explains contexts in generality  -td
122
123 @c TODO Describe propagation of property values -td
124
125 コンテキストは階層的に配置されます:
126
127 @menu
128 * Score - すべてのコンテキストのマスタ::
129 * 上位コンテキスト - 譜コンテナ::
130 * 中位コンテキスト - 譜::
131 * 下位コンテキスト - ボイス::
132 @end menu
133
134 @node Score - すべてのコンテキストのマスタ
135 @unnumberedsubsubsec Score - すべてのコンテキストのマスタ
136 @translationof Score - the master of all contexts
137
138 これは最上位の記譜コンテキストです。@c
139 他のコンテキストが Score コンテキストを保持することはできません。@c
140 デフォルトでは、Score コンテキストが拍子記号の管理を扱い、@c
141 音部記号、拍子記号、調号などのアイテムが譜間で揃っていることを保証します。
142
143 Score コンテキストは、@code{\score @{@dots{}@}} や @code{\layout @{@dots{}@}}
144 ブロックが処理されたときに暗黙的にインスタンス化されます。@c
145 @c また、@code{\new Score} コマンドが実行されたときに@c
146 @c 明示的にインスタンス化されます。
147
148
149 @node 上位コンテキスト - 譜コンテナ
150 @unnumberedsubsubsec 上位コンテキスト - 譜コンテナ
151 @translationof Top-level contexts - staff containers
152
153 @strong{@emph{StaffGroup}}
154
155 譜をグループ化して、左端に角括弧を付けます。@c
156 このコンテキストに保持されている譜の小節線は垂直につながります。@c
157 @code{StaffGroup} は譜のコレクション、@c
158 それに左端の角括弧と延長された小節線だけを保持します。
159
160 @strong{@emph{ChoirStaff}}
161
162 保持されている譜の小節線が垂直につながらないことを除けば、@c
163 @code{StaffGroup} と同じです。
164
165 @strong{@emph{GrandStaff}}
166
167 譜をグループ化して、左端に波括弧を付けます。@c
168 このコンテキストに保持されている譜の小節線は垂直につながります。@c
169
170 @strong{@emph{PianoStaff}}
171
172 @code{GrandStaff} と似ていますが、@c
173 各システムの左端に楽器名を付けることができます。
174
175
176 @node 中位コンテキスト - 譜
177 @unnumberedsubsubsec 中位コンテキスト - 譜
178 @translationof Intermediate-level contexts - staves
179
180 @strong{@emph{Staff}}
181
182 音部記号、小節線、調、臨時記号を扱います。@c
183 このコンテキストは @code{Voice} コンテキストを保持することができます。
184
185 @strong{@emph{RhythmicStaff}}
186
187 @code{Staff} と似ていますが、リズムを表示するためのものです。@c
188 ピッチは無視され、音符は線として表示されます。
189
190 @strong{@emph{TabStaff}}
191
192 タブ譜を生成するためのコンテキストです。@c
193 デフォルトでは、音楽表記を 6 線のギター タブ譜として配置します。
194
195 @strong{@emph{DrumStaff}}
196
197 打楽器の譜刻を扱います。@c
198 @code{DrumVoice} を保持することができます。
199
200 @strong{@emph{VaticanaStaff}}
201
202 @code{Staff} と同じですが、@c
203 グレゴリア形式の楽曲を譜刻するためにデザインされている点が異なります。
204
205 @strong{@emph{MensuralStaff}}
206
207 @code{Staff} と同じでが、@c
208 定量形式の楽曲を譜刻するためにデザインされている点が異なります。
209
210 @node 下位コンテキスト - ボイス
211 @unnumberedsubsubsec 下位コンテキスト - ボイス
212 @translationof Bottom-level contexts - voices
213
214 Voice レベルのコンテキストはある特定のプロパティを初期化し、@c
215 適切なエングラーバを開始させます。@c
216 下位コンテキストであるため、他のコンテキストを保持することはできません。
217
218 @strong{@emph{Voice}}
219
220 譜の上にあるボイスに相当します。@c
221 このコンテキストは、強弱記号、符幹、連桁、上付き/下付き文字、タイ、@c
222 それに休符の変換を扱います。@c
223 1 つの譜に複数のボイスを配置する必要がある場合、@c
224 ボイスを明示的にインスタンス化する必要があります。
225
226 @strong{@emph{VaticanaVoice}}
227
228 @code{Voice} と同じですが、@c
229 グレゴリア形式の楽曲を譜刻するためにデザインされている点が異なります。
230
231 @strong{@emph{MensuralVoice}}
232
233 @code{Voice} と同じですが、@c
234 定量形式の楽曲を譜刻するためにデザインされている点が異なります。
235
236 @strong{@emph{Lyrics}}
237
238 歌詞を保持するボイスに相当します。単一行の歌詞の表示を扱います。
239
240 @strong{@emph{DrumVoice}}
241
242 打楽器譜で使用されるボイス コンテキストです。
243
244 @strong{@emph{FiguredBass}}
245
246 このコンテキストの中で、@c
247 @code{\figuremode} モードで記述された入力から
248 @code{BassFigure} オブジェクトが作成されます。
249
250 @strong{@emph{TabVoice}}
251
252 @code{TabStaff} コンテキスト内部で使用されるボイス コンテキストです。@c
253 通常、暗黙的に作成されます。
254
255 @strong{@emph{CueVoice}}
256
257 小さなサイズの音符を描画するために使用されるボイス コンテキストです。@c
258 主に合図音符を譜に付け加えることを目的としています。@c
259 @ref{合図音符をフォーマットする} を参照してください。@c
260 通常、暗黙的に作成されます。
261
262 @strong{@emph{ChordNames}}
263
264 コード ネームを譜刻します。
265
266 @ignore
267 TODO
268
269 Then the following, which I don't know what to do with:
270
271     * GregorianTranscriptionVoice
272     * GregorianTranscriptionStaff
273
274     * FretBoards
275         Engraves fretboards from chords. Not easy... Not
276 documented.
277         There is now some documentation on FretBoards in the NR, under
278          instrument-specific notation -- cds.
279
280     * NoteNames
281
282     * Global
283         Hard coded entry point for LilyPond. Cannot be tuned.
284     * Devnull
285         Silently discards all musical information given to this
286 context.
287
288 @end ignore
289
290 @node コンテキストを作成する
291 @subsection コンテキストを作成する
292 @translationof Creating contexts
293
294 @c TODO more complete descriptions rather than learning style
295
296 ボイスと譜が 1 つだけの楽譜では、コンテキストは自動的に作成されます。@c
297 もっと複雑な楽譜では、手動でコンテキストを作成する必要があります。@c
298 コンテキスを作成するために 3 つのコマンドがあります。
299
300 @itemize
301
302 @item
303 もっとも簡単なコマンドは @code{\new} であり、@c
304 もっとも素早く入力できるコマンドでもあります。@c
305 このコマンドは音楽表記の前に置きます。例えば、以下のように:
306
307 @funindex \new
308 @cindex new contexts (新しいコンテキスト)
309 @cindex Context, creating (コンテキストを作成する)
310
311 @example
312 \new @var{type} @var{music expression}
313 @end example
314
315 @noindent
316 ここで、@var{type} はコンテキスト名 (@code{Staff} や @code{Voice} など) です。@c
317 このコマンドは新しいコンテキストを作成し、@c
318 そのコンテキストに付属する @var{音楽表記} の解釈を開始します。
319
320 @code{\new} の実際的な使用例には、多くの譜を持つ楽譜があります。@c
321 それぞれの譜に配置される各パートの前に @code{\new Staff} を記述します。
322
323 @lilypond[quote,verbatim,relative=2,ragged-right,fragment]
324 <<
325   \new Staff { c4 c }
326   \new Staff { d4 d }
327 >>
328 @end lilypond
329
330 @code{\new} コマンドは、コンテキストに名前を与えることもできます:
331
332 @example
333 \new @var{type} = @var{id} @var{music}
334 @end example
335
336 しかしながら、ユーザが指定したコンテキスト名は、
337 そのコンテキスト以前に同じ名前を与えられたコンテキストが無い場合にのみ、@c
338 使用できます。
339
340
341 @funindex \context
342
343 @item
344 @code{\new} と同様に、@c
345 @code{\context} コマンドも音楽表記をコンテキスト オブジェクトに代入します。@c
346 しかしながら、このコマンドはコンテキストに明示的に名前を与えます。@c
347 構文は以下の通りです:
348
349 @example
350 \context @var{type} = @var{id} @var{music}
351 @end example
352
353 この構文は @var{id} という名前の @var{type} タイプのコンテキストが@c
354 すで存在していないか検索します。@c
355 コンテキストがまだ存在していなければ、@c
356 指定された名前を持つコンテキストが新たに作成されます。@c
357 これは、コンテキストを後で参照する場合に有用です。@c
358 例えば、以下のように名前を付けられたメロディ:
359
360 @example
361 \context Voice = "@b{tenor}" @var{music}
362 @end example
363
364 @noindent
365 に、以下のように歌詞を設定すると、テキストは適切に音符に揃えられます:
366
367 @example
368 \new Lyrics \lyricsto "@b{tenor}" @var{lyrics}
369 @end example
370
371 @noindent
372
373 名前付きコンテキストの他の使用例として、2 つの音楽表記をつなげて
374 1 つのコンテキストにすることができます。@c
375 以下の例では、アーティキュレーションと音符は別々に入力されています:
376
377 @example
378 music = @{ c4 c4 @}
379 arts = @{ s4-. s4-> @}
380 @end example
381
382 これらを同じ @code{Voice} コンテキストに送ることによって@c
383 組み合わせることができます:
384
385 @example
386 <<
387   \new Staff \context Voice = "A" \music
388   \context Voice = "A" \arts
389 >>
390 @end example
391 @lilypond[quote,ragged-right]
392 music = { c4 c4 }
393 arts = { s4-. s4-> }
394 \relative c'' <<
395   \new Staff \context Voice = "A" \music
396   \context Voice = "A" \arts
397 >>
398 @end lilypond
399
400 このメカニズムを用いることで、原典版 (オリジナル版) を定義し、@c
401 オプションとしてそれに異なるアーティキュレーションを付けることができます。
402
403 @cindex creating contexts (コンテキストを作成する)
404
405 @item
406 コンテキストを作成する 3 つ目のコマンドは以下の通りです:
407
408 @example
409 \context @var{type} @var{music}
410 @end example
411
412 @noindent
413 これは @code{= @var{id}} を持つ @code{\context} に似ていますが、@c
414 タイプ @var{type} のすべてのコンテキストに適用されます
415 -- そのコンテキストに与えられた名前とは関係なく適用されます。@c
416
417 この構文の変形版は、@c
418 異なる階層で解釈される可能性がある音楽表記に対して使用されます。@c
419 例えば、@code{\applyOutput} コマンド
420 (@rextend{Running a function on all layout objects} を参照してください)
421 です。@c
422 明示的に @code{\context} を指定しなければ、通常は @code{Voice} に適用されます。
423
424 @example
425 \applyOutput #'@var{context} #@var{function}   % Voice に適用されます
426 @end example
427
428 @code{Score} レベルや @code{Staff} レベルで解釈させるには、以下のようにします:
429
430 @example
431 \applyOutput #'Score #@var{function}
432 \applyOutput #'Staff #@var{function}
433 @end example
434
435 @end itemize
436
437
438 @node コンテキストを残しておく
439 @subsection コンテキストを残しておく
440 @translationof Keeping contexts alive
441
442 @cindex contexts, keeping alive (コンテキストを残しておく)
443 @cindex contexts, lifetime (コンテキストのライフタイム)
444
445 通常、コンテキストは何もすることが無くなった最初の音楽的タイミングで@c
446 消滅させられます。@c
447 そのため、@code{Voice} コンテキストはすべてのイベントを終えるとすぐに消滅し、@c
448 @code{Staff} コンテキストは保持しているすべての @code{Voice} コンテキストの@c
449 イベントが終了するとすぐに消滅する、などとなっています。@c
450 このことは、早い段階のすでに消滅したコンテキスを参照する必要がある場合に、@c
451 障害となります。@c
452 例えば、@code{\change} コマンドで譜を変更する場合、@c
453 @code{\lyricsto} コマンドで歌詞をボイスに結び付ける場合、@c
454 あるいは、早い段階で登場したコンテキストに音楽イベントを追加する場合に@c
455 障害となります。
456
457 この規則には 1 つ例外があります:
458 @code{Staff} コンテキストや @code{<<...>>} 構造の中にある @code{Voice}
459 コンテキストのうち 1 つだけは、例え途中ですることが無くなったとしても、@c
460 @code{Staff} コンテキストあるいは
461 @code{<<...>>} 構造の終わりまで維持されます。@c
462 このように維持されるコンテキストは、最初の @code{@{...@}} 構造の中にある@c
463 最初のコンテキストであり、@code{<<...>>} 構造の中にあるものは無視されます。
464
465 各音楽タイミングで何かすることを持たせることにより、@c
466 任意のコンテキストを残しておくことができます。@c
467 @code{Staff} コンテキストを残しておくには、それに含まれるボイスの 1 つが@c
468 維持されることを保証する必要があります。@c
469 ボイスを残しておく方法の 1 つに、ボイスに含まれる実際の音楽と並列に、@c
470 空白休符をそのボイスに付け加えるという方法があります。@c
471 残しておく必要があるすべての @code{Voice} コンテキストに対して、@c
472 空白休符を付け加える必要があります。@c
473 ところどころで使用されるボイスがある場合、@c
474 前述の例外によって必要なボイスを残そうとするよりは、@c
475 それらのボイスすべてを残しておく方が安全です。
476
477 以下の例では、空白休符の追加を用いる方法で、@c
478 ボイス A とボイス B の両方が楽曲全体を通して維持されます:
479
480 @c KEEP LY
481 @lilypond[quote,verbatim]
482 musicA = \relative c'' { d4 d d d }
483 musicB = \relative c'' { g4 g g g }
484 keepVoicesAlive = {
485   <<
486     \new Voice = "A" { s1*5 }  % Voice "A" を 5 小節の間、維持する
487     \new Voice = "B" { s1*5 }  % Voice "B" を 5 小節の間、維持する
488   >>
489 }
490
491 music = {
492   \context Voice = "A" {
493     \voiceOneStyle
494     \musicA
495   }
496   \context Voice = "B" {
497     \voiceTwoStyle
498     \musicB
499   }
500   \context Voice = "A" { \musicA }
501   \context Voice = "B" { \musicB }
502   \context Voice = "A" { \musicA }
503 }
504
505 \score {
506   \new Staff <<
507     \keepVoicesAlive
508     \music
509   >>
510 }
511 @end lilypond
512
513 @cindex lyrics, aligning with sporadic melody (途切れ途切れのメロディに歌詞を揃える)
514
515 以下の例は、空白休符を用いる方法で、@c
516 途切れ途切れのメロディに歌詞を持たせる方法を示しています。@c
517 もちろん、実際に楽譜を書く場合は、@c
518 メロディや伴奏は複数のセクションによって構成されることになります。
519
520 @c KEEP LY
521 @lilypond[quote,verbatim]
522 melody = \relative c'' { a4 a a a }
523 accompaniment = \relative c' { d4 d d d }
524 words = \lyricmode { These words fol -- low the mel -- o -- dy }
525 \score {
526   <<
527     \new Staff = "music" {
528       <<
529         \new Voice = "melody" {
530           \voiceOne
531           s1*4  % Voice "melody" を 4 小節の間、残します
532         }
533         {
534           \new Voice = "accompaniment" {
535             \voiceTwo
536             \accompaniment
537           }
538           <<
539             \context Voice = "melody" { \melody }
540             \context Voice = "accompaniment" { \accompaniment }
541           >>
542           \context Voice = "accompaniment" { \accompaniment }
543           <<
544             \context Voice = "melody" { \melody }
545             \context Voice = "accompaniment" { \accompaniment }
546           >>
547         }
548       >>
549     }
550     \new Lyrics \with { alignAboveContext = #"music" }
551     \lyricsto "melody" { \words }
552   >>
553 }
554 @end lilypond
555
556 これに代わる方法として、メロディに直接空白休符を付け加えて、@c
557 メロディが伴奏と揃うようにする方法があります
558 -- 多くの場合、こちらの方法の方が良いかもしれません:
559
560 @c KEEP LY
561 @lilypond[quote,verbatim]
562 melody = \relative c'' {
563   s1  % 1 小節スキップします
564   a4 a a a
565   s1  % 1 小節スキップします
566   a4 a a a
567 }
568 accompaniment = \relative c' {
569   d4 d d d
570   d4 d d d
571   d4 d d d
572   d4 d d d
573 }
574 words = \lyricmode { These words fol -- low the mel -- o -- dy }
575
576 \score {
577   <<
578     \new Staff = "music" {
579       <<
580         \new Voice = "melody" {
581           \voiceOne
582           \melody
583         }
584         \new Voice = "accompaniment" {
585           \voiceTwo
586           \accompaniment
587         }
588       >>
589     }
590     \new Lyrics \with { alignAboveContext = #"music" }
591     \lyricsto "melody" { \words }
592   >>
593 }
594 @end lilypond
595
596
597 @node コンテキストのプラグインを変更する
598 @subsection コンテキストのプラグインを変更する
599 @translationof Modifying context plug-ins
600
601 @c TODO Should this be Modifying engravers or Modifying contexts?
602
603 記譜コンテキスト (@code{Score} や @code{Staff} のような) は@c
604 プロパティを保存するだけなく、@c
605 @q{エングラーバ} と呼ばれる記譜要素を作成するプラグインを保持します。@c
606 例えば、@code{Voice} コンテキストは @code{Note_head_engraver} を保持し、@c
607 @code{Staff} コンテキストは @code{Key_signature_engraver} を保持します。
608
609 各プラグインについての説明は、
610 @ifhtml
611 @rinternals{Engravers and Performers}.
612 @end ifhtml
613 @ifnothtml
614 Internals Reference @expansion{} Translation @expansion{} Engravers.
615 @end ifnothtml
616 を参照してください。@c
617 @ifhtml
618 @rinternals{Contexts}
619 @end ifhtml
620 @ifnothtml
621 Internals Reference @expansion{} Translation @expansion{} Context.
622 @end ifnothtml
623 の中にある各コンテキストについての説明では、@c
624 そのコンテキストで使用されるエングラーバがリストアップされています。
625
626 これらのプラグインを入れ換えると有用な場合があります。@c
627 プラグインを入れ換えるには、新たに作成するコンテキストを
628 @code{\new} あるいは @code{\context} で開始し、@c
629 そのコンテキストを以下のように変更します:
630
631 @funindex \with
632
633 @example
634 \new @var{context} \with @{
635   \consists @dots{}
636   \consists @dots{}
637   \remove @dots{}
638   \remove @dots{}
639   @emph{etc.}
640 @}
641 @{
642   @emph{..music..}
643 @}
644 @end example
645
646 @noindent
647 ここで、@dots{} はエングラーバの名前になります。@c
648 ここで、@code{Staff} コンテキストから @code{Time_signature_engraver} と
649 @code{Clef_engraver} を削除する簡単な例を示します:
650
651 @lilypond[quote,relative=1,verbatim,fragment]
652 <<
653   \new Staff {
654     f2 g
655   }
656   \new Staff \with {
657      \remove "Time_signature_engraver"
658      \remove "Clef_engraver"
659   } {
660     f2 g2
661   }
662 >>
663 @end lilypond
664
665 2 番目の譜には、拍子記号と音部記号がありません。@c
666 この方法は、オブジェクトを不可視にするよりも乱暴な方法です。@c
667 なぜなら、譜全体に影響を与えるからです。@c
668 さらに、望む望まないに係わらず、この方法はスペースにも影響を与えます。@c
669 オブジェクトを消すもっと洗練された方法については、@c
670 @rlearning{オブジェクトの可視性と色} を参照してください。
671
672 次の例は、ある実用的な応用です。@c
673 通常、小節線と拍子記号は楽譜全体で同期されます。@c
674 これは @code{Timing_translator} と @code{Default_bar_line_engraver}
675 によって行われます。@c
676 このプラグインは拍子記号の管理や、小節内の配置の管理などを行います。@c
677 これらのエングラーバを @code{Score} コンテキストから
678 @code{Staff} コンテキストへ異動させることにより、@c
679 楽譜の各譜に独自の拍子記号を持たせることが可能になります。
680
681 @cindex polymetric scores (複合拍子楽譜)
682 @cindex Time signatures, multiple (複数の拍子記号)
683
684 @lilypond[quote,relative=1,ragged-right,verbatim,fragment]
685 \new Score \with {
686   \remove "Timing_translator"
687   \remove "Default_bar_line_engraver"
688 } <<
689   \new Staff \with {
690     \consists "Timing_translator"
691     \consists "Default_bar_line_engraver"
692   } {
693       \time 3/4
694       c4 c c c c c
695   }
696   \new Staff \with {
697     \consists "Timing_translator"
698     \consists "Default_bar_line_engraver"
699   } {
700        \time 2/4
701        c4 c c c c c
702   }
703 >>
704 @end lilypond
705
706 @knownissues
707
708 通常、エングラーバが指定される順序は問題にはなりません。@c
709 しかしながら、いくつかの特殊なケースでは、この順序が重要になります。@c
710 例えば、あるエングラーバがプロパティを記述して、@c
711 それを他のエングラーバが読む場合、あるいは、@c
712 あるエングラーバがグラフィカル オブジェクトを作成し、@c
713 それを他のエングラーバが処理しなければならない場合です。@c
714 エングラーバは指定された順序に従って呼び出され、処理を実行します。
715
716 以下の順序は重要です:
717 通常、@code{Bar_engraver} を最初に指定し、@c
718 @code{New_fingering_engraver} を @code{Script_column_engraver} の前で@c
719 指定する必要があります。@c
720 他にも指定順序が問題になるケースがあるかもしれません。
721
722
723 @node コンテキストのデフォルト設定を変更する
724 @subsection コンテキストのデフォルト設定を変更する
725 @translationof Changing context default settings
726
727 @code{Score}, @code{Staff} それに @code{Voice} コンテキストにおいて@c
728 デフォルトで使用されるコンテキスト設定は、以下の例で示すように、@c
729 @code{\layout} ブロックの中で指定することができます。@c
730 @code{\layout} ブロックは、それを適用する @code{\score} ブロックの中で、かつ、@c
731 音楽表記の外側に配置する必要があります。
732
733 以下のような方法でコンテキストのデフォルト値を指定する場合、@c
734 @code{\set} コマンドとコンテキストを@c
735 省略する必要があるということに注意してください:
736
737 @lilypond[quote,verbatim]
738 \score {
739   \relative c'' {
740     a4^"Really small, thicker stems, no time signature" a a a
741     a a a a
742   }
743   \layout {
744     \context {
745       \Staff
746       fontSize = #-4
747       \override Stem #'thickness = #4.0
748       \remove "Time_signature_engraver"
749     }
750   }
751 }
752 @end lilypond
753
754 上記の例の中で、@code{\Staff} コマンドは、@c
755 後に続く記述をその score ブロックの中にあるすべての譜に適用するということを@c
756 指定しています。
757
758 同様の方法で、@c
759 @code{Score} コンテキストや @code{Voice} コンテキストに@c
760 変更を適用することができます。
761
762 @knownissues
763
764 変数に加えられたコンテキストの変更を収集すること、それに、@c
765 その変数を参照することでそれらの変更を @code{\context} 定義に@c
766 適用することはできません。
767
768 @code{\RemoveEmptyStaffContext} はカレントの
769 @code{\Staff} 設定を上書きします。@c
770 @code{\RemoveEmptyStaffContext} を使用する staff
771 のデフォルト設定を変更したいのならば、@c
772 @code{\RemoveEmptyStaffContext} を呼び出した後に@c
773 変更を加える必要があります。@c
774 つまり、以下のようにします:
775
776 @example
777 \layout @{
778   \context @{
779     \RemoveEmptyStaffContext
780
781     \override Stem #'thickness = #4.0
782   @}
783 @}
784 @end example
785
786 @c TODO: add \with in here.
787
788
789 @node 新しいコンテキストを定義する
790 @subsection 新しいコンテキストを定義する
791 @translationof Defining new contexts
792
793 @cindex contexts, defining new (新しいコンテキストを定義する)
794 @cindex engravers, including in contexts (エングラーバをコンテキストに含める)
795
796 @funindex \alias
797 @funindex alias
798 @funindex \name
799 @funindex name
800 @funindex \type
801 @funindex type
802 @funindex \consists
803 @funindex consists
804 @funindex \accepts
805 @funindex accepts
806 @funindex \denies
807 @funindex denies
808
809 @code{Staff} や @code{Voice} のようなコンテキストは、@c
810 簡単なブロックの組み合わせで構成されています。
811 エングラーバ プラグインの組み合わせを変えることで、@c
812 新しいタイプのコンテキスを作成することができます。
813
814 次の例は、ゼロからタイプの異なる @code{Voice} コンテキストを作り上げる方法を@c
815 示しています。@c
816 このコンテキストは @code{Voice} コンテキストに似ていますが、@c
817 音符の代わりにスラッシュを譜の中央に譜刻します。@c
818 これはジャズで即興を表すのに使うことができます。
819
820 @lilypond[quote,ragged-right]
821 \layout { \context {
822   \name ImproVoice
823   \type "Engraver_group"
824   \consists "Note_heads_engraver"
825   \consists "Rhythmic_column_engraver"
826   \consists "Text_engraver"
827   \consists Pitch_squash_engraver
828   squashedPosition = #0
829   \override NoteHead #'style = #'slash
830   \override Stem #'transparent = ##t
831   \override Flag #'transparent = ##t
832   \alias Voice
833 }
834 \context { \Staff
835   \accepts "ImproVoice"
836 }}
837
838 \relative c'' {
839   a4 d8 bes8 \new ImproVoice { c4^"ad lib" c
840    c4 c^"undress" c_"while playing :)" c }
841   a1
842 }
843 @end lilypond
844
845
846 これらの設定は @code{\layout} ブロック内部の @code{\context} ブロック@c
847 の中で定義します:
848
849 @example
850 \layout @{
851   \context @{
852     @dots{}
853   @}
854 @}
855 @end example
856
857 以下では、上記の例の @dots{} に入るべき入力について議論します。
858
859 最初に、新しいコンテキストの名前を定義する必要があります:
860
861 @example
862 \name ImproVoice
863 @end example
864
865 このコンテキストは @code{Voice} に似せる必要があるため、@c
866 (既存の) @code{Voice} と同じ機能を実現するコマンドが必要です。@c
867 これは、新しいコンテキストにエイリアス @code{Voice} を与えることで実現できます。
868
869 @example
870 \alias Voice
871 @end example
872
873 このコンテキストは音符と指示テキストを譜刻しますので、@c
874 それらの機能を提供するエングラーバを付け加える必要があります:
875
876 @example
877 \consists Note_heads_engraver
878 \consists Text_engraver
879 @end example
880
881 しかしながら、音符の代わりにスラッシュを譜の中央線上に配置します:
882
883 @example
884 \consists Pitch_squash_engraver
885 squashedPosition = #0
886 @end example
887
888 @rinternals{Pitch_squash_engraver} は
889 (@rinternals{Note_heads_engraver} によって作成される) 符頭を変更し、@c
890 符頭の垂直位置を @code{squashedPosition} にセットします
891 -- 今回は @code{0}、つまり中央線上です。
892
893 音符はスラッシュで、符幹を持ちません:
894
895 @example
896 \override NoteHead #'style = #'slash
897 \override Stem #'transparent = ##t
898 \override Flag #'transparent = ##t
899 @end example
900
901 これらのプラグインすべてが共同する必要があり、@c
902 それには特殊なプラグインが必要です。@c
903 このプラグインは常に @code{Engraver_group} であり、@c
904 キーワード @code{\type} を付ける必要があります。
905
906 @example
907 \type "Engraver_group"
908 @end example
909
910 まとめると、以下のようになります:
911
912 @example
913 \context @{
914   \name ImproVoice
915   \type "Engraver_group"
916   \consists "Note_heads_engraver"
917   \consists "Text_engraver"
918   \consists Pitch_squash_engraver
919   squashedPosition = #0
920   \override NoteHead #'style = #'slash
921   \override Stem #'transparent = ##t
922   \override Flag #'transparent = ##t
923   \alias Voice
924 @}
925 @end example
926
927 @funindex \accepts
928 コンテキストは階層を構成します。c
929 通常の @code{Voice} と同様に、@c
930 @code{ImproVoice} を @code{Staff} の下に置く必要があります。@c
931 それゆえ、@code{Staff} 定義を @code{\accepts} コマンドで変更します:
932
933 @example
934 \context @{
935   \Staff
936   \accepts ImproVoice
937 @}
938 @end example
939
940 @funindex \denies
941 @code{\accepts} の反対は @code{\denies} です。@c
942 これは既存のコンテキスト定義を再利用する場合に必要となります。
943
944 以下のように、両方を @code{\layout} ブロックの中に置きます:
945
946 @example
947 \layout @{
948   \context @{
949     \name ImproVoice
950     @dots{}
951   @}
952   \context @{
953     \Staff
954     \accepts "ImproVoice"
955   @}
956 @}
957 @end example
958
959 それから、このサブセクションの最初にあった出力を入力します:
960
961 @example
962 \relative c'' @{
963   a4 d8 bes8
964   \new ImproVoice @{
965     c4^"ad lib" c
966     c4 c^"undress"
967     c c_"while playing :)"
968   @}
969   a1
970 @}
971 @end example
972
973
974 @node コンテキストを揃える
975 @subsection コンテキストを揃える
976 @translationof Aligning contexts
977
978 新しいコンテキストを既存のコンテキストの上または下に揃えることができます。@c
979 これはボーカル譜 (@rlearning{合唱}) を組む場合やオッシアで役に立ちます。
980
981 @c TODO Better example needed.  Ref LM, and expand on it.
982
983 @cindex ossia (オッシア)
984 @funindex alignAboveContext
985 @funindex alignBelowContext
986
987 @lilypond[quote,ragged-right]
988 ossia = { f4 f f f }
989 \score{
990   \relative c' \new Staff = "main" {
991     c4 c c c
992     <<
993       \new Staff \with { alignAboveContext = #"main" } \ossia
994       { d8 f d f d f d f }
995     >>
996   }
997 }
998 @end lilypond
999
1000 @cindex nested contexts (ネストされたコンテキスト)
1001 @cindex contexts, nested (ネストされたコンテキスト)
1002
1003 @funindex \accepts
1004 @funindex \denies
1005
1006 @code{PianoStaff} のようなコンテキストは、@c
1007 ネスト (入れ子) 構造をとって、@c
1008 他のコンテキストを内部に保持することができます。@c
1009 ネスト構造をとることができるコンテキストは、@c
1010 コンテキストの @qq{accepts} リストによって定義されています。@c
1011 このリストには存在しないコンテキストは、楽譜が譜刻されるとき、@c
1012 (@code{PianoStaff} などの) 親コンテキストの下に配置されます。@c
1013 例えば、@code{PianoStaff} コンテキストは、デフォルトで、@c
1014 @code{Staff} と @code{FiguredBass} コンテキストを内部に受け入れるよう@c
1015 定義されていますが、(例えば) @code{Lyrics} コンテキストは受け入れません。@c
1016 そのため、以下の例では、歌詞は 2 つの譜の間ではなく、@c
1017 ピアノ譜の下に配置されています:
1018
1019 @lilypond[verbatim,quote,relative=1]
1020 \new PianoStaff
1021 <<
1022   \new Staff { e4 d c2 }
1023   \addlyrics { Three blind mice }
1024   \new Staff {
1025     \clef "bass"
1026     { c,1 }
1027   }
1028 >>
1029 @end lilypond
1030
1031 コンテキストの @qq{accepts} リストを変更することで、
1032 ネストされるコンテキストを追加するができます。@c
1033 ですから、歌詞を 2 つの譜の間に表示させたいのなら、以下のようにします:
1034
1035 @lilypond[verbatim,quote,relative=1]
1036 \new PianoStaff \with { \accepts Lyrics }
1037 <<
1038   \new Staff { e4 d c2 }
1039   \addlyrics { Three blind mice }
1040   \new Staff {
1041     \clef "bass"
1042     { c,1 }
1043   }
1044 >>
1045 @end lilypond
1046
1047 @code{\accepts} の反対は @code{\denies} です。@c
1048 これはコンテキストを @qq{accepts} リストから削除します。
1049
1050
1051 @node 内部リファレンスの説明
1052 @section 内部リファレンスの説明
1053 @translationof Explaining the Internals Reference
1054
1055
1056 @menu
1057 * 内部リファレンスを使いこなす::
1058 * レイアウト インターフェイス::
1059 * グラフィカル オブジェクトを決定する::
1060 * 命名規約::
1061 @end menu
1062
1063 @node 内部リファレンスを使いこなす
1064 @subsection 内部リファレンスを使いこなす
1065 @translationof Navigating the program reference
1066
1067 @c TODO remove this (it's in the LM)
1068 @c Replace with more factual directions
1069
1070 以下の譜面の運指記号を移動させたいとします:
1071
1072 @lilypond[quote,relative=2,verbatim]
1073 c-2
1074 \stemUp
1075 f
1076 @end lilypond
1077
1078 運指指示のドキュメント (@ref{運指の指示}) を見ると、@c
1079 以下のようなセクションがあることに気付くはずです:
1080
1081 @quotation
1082 @strong{参照}
1083
1084 内部リファレンス: @rinternals{Fingering}
1085
1086 @end quotation
1087
1088
1089 @c  outdated info; probably will delete.
1090 @ignore
1091 This fragment points to two parts of the program reference: a page
1092 on @code{FingeringEvent} and one on @code{Fingering}.
1093
1094 The page on @code{FingeringEvent} describes the properties of the music
1095 expression for the input @code{-2}.  The page contains many links
1096 forward.  For example, it says
1097
1098 @quotation
1099 Accepted by: @rinternals{Fingering_engraver},
1100 @end quotation
1101
1102 @noindent
1103 That link brings us to the documentation for the Engraver, the
1104 plug-in, which says
1105
1106 @quotation
1107 This engraver creates the following layout objects: @rinternals{Fingering}.
1108 @end quotation
1109
1110 In other words, once the @code{FingeringEvent}s are interpreted, the
1111 @code{Fingering_engraver} plug-in will process them.
1112 @end ignore
1113
1114 @ignore
1115 @c  I can't figure out what this is supposed to mean.  -gp
1116
1117 The @code{Fingering_engraver} is also listed to create
1118 @rinternals{Fingering} objects,
1119
1120 @c  old info?  it doesn't make any sense to me with our current docs.
1121 This is also the
1122 second bit of information listed under @b{See also} in the Notation
1123 manual.
1124 @end ignore
1125
1126 @ifnothtml
1127 内部リファレンスは HTML ドキュメント形式で入手可能です。@c
1128 内部リファレンスは、オンラインか HTML ドキュメントをダウンロードするかして、@c
1129 HTML 形式で読むことを強く推奨します。@c
1130 PDF マニュアルを使用していると、@c
1131 このセクションを理解するのはずっと困難になります。@c
1132 (訳者: 日本語では PDF 形式での提供はありません。)
1133 @end ifnothtml
1134
1135 @rinternals{Fingering} へのリンクを辿ってください。@c
1136 ページの先頭に、以下のような記述があります:
1137
1138 @quotation
1139 Fingering objects are created by: @rinternals{Fingering_engraver} and
1140 @rinternals{New_fingering_engraver}.
1141 @end quotation
1142
1143 内部リファレンスの中にある関連リンクを辿っていくことで、@c
1144 プログラム内部の情報フローを追っていくことができます:
1145
1146 @itemize
1147
1148 @item @rinternals{Fingering}:
1149 @rinternals{Fingering} objects are created by:
1150 @rinternals{Fingering_engraver}
1151
1152 (@rinternals{Fingering}:
1153 @rinternals{Fingering} オブジェクトを作成するのは:
1154 @rinternals{Fingering_engraver})
1155
1156
1157 @item @rinternals{Fingering_engraver}:
1158 Music types accepted:
1159 @rinternals{fingering-event}
1160
1161 (@rinternals{Fingering_engraver}:
1162 受け取る音楽タイプは: @rinternals{fingering-event})
1163
1164 @item @rinternals{fingering-event}:
1165 Music event type @code{fingering-event} is in
1166 Music expressions named @rinternals{FingeringEvent}
1167
1168 (@rinternals{fingering-event}:
1169 音楽イベント タイプ @code{fingering-event} は
1170 @rinternals{FingeringEvent} という名前の音楽表記の中にあります)
1171
1172 @end itemize
1173
1174 このパスは、プログラム内部での情報フローとは逆向きです:
1175 出力からスタートして、入力イベントで終わっています。@c
1176 入力イベントからスタートして、情報フローを読み進め、@c
1177 最後は出力オブジェクトに辿り着くこともできます。
1178
1179 内部リファレンスを通常のドキュメントのように読むこともできます。@c
1180 内部リファレンスに含まれる章は、
1181 @ifhtml
1182 @rinternals{Music definitions},
1183 @end ifhtml
1184 @ifnothtml
1185 @code{Music definitions},
1186 @end ifnothtml
1187 @rinternals{Translation}, それに @rinternals{Backend} です。
1188 各章は、使用されているすべての定義と調整可能なすべてのプロパティを@c
1189 リストアップしています。
1190
1191
1192 @node レイアウト インターフェイス
1193 @subsection レイアウト インターフェイス
1194 @translationof Layout interfaces
1195
1196 @cindex interface, layout (レイアウト インターフェイス)
1197 @cindex layout interface (レイアウト インターフェイス)
1198 @cindex grob (グラフィカル オブジェクト)
1199
1200 前のセクションで見た HTML ページには、@c
1201 @rinternals{Fingering} と呼ばれるレイアウト オブジェクトについての@c
1202 記述がありました。@c
1203 そのようなオブジェクトは楽譜で記号となります。@c
1204 レイアウト オブジェクトは (太さや向きのような) 数値を保持する@c
1205 プロパティを持っていますが、@c
1206 関連オブジェクトへのポインタも持っています。@c
1207 レイアウト オブジェクトは @emph{Grob}
1208 -- これはグラフィカル オブジェクトを縮めたものです --
1209 とも呼ばれます。@c
1210 Grob についての詳細は、@rinternals{grob-interface} を参照してください。
1211
1212 @code{Fingering} のページは、@c
1213 @code{Fingering} オブジェクトの定義をリストアップしています。@c
1214 例えば、このページには以下のような記述があります:
1215
1216 @quotation
1217 @code{padding} (dimension, in staff space):
1218
1219 @code{0.5}
1220 @end quotation
1221
1222 @noindent
1223 これは、この数値は少なくとも符頭の 0.5 倍の距離を保つということを意味します。
1224
1225
1226 各レイアウト オブジェクトは、記譜要素あるいは写植要素としての機能を@c
1227 いくつか持つ場合があります。@c
1228 例えば、@code{Fingering} オブジェクトは以下の側面を持っています:
1229
1230 @itemize
1231 @item
1232 Its size is independent of the horizontal spacing, unlike slurs or beams.
1233
1234 (このオブジェクトのサイズは、スラーや連桁と異なり、@c
1235 水平方向のスペースとは無関係です)
1236
1237 @item
1238 It is a piece of text.  Granted, it is usually a very short text.
1239
1240 (このオブジェクトはテキストです。通常、これは非常に短いテキストです。)
1241
1242 @item
1243 That piece of text is typeset with a font, unlike slurs or beams.
1244
1245 (このテキストは、スラーや連桁と異なり、フォントで写植されます。)
1246
1247 @item
1248 Horizontally, the center of the symbol should be aligned to the
1249 center of the note head.
1250
1251 (水平方向では、この記号の中心は符頭の中心に揃えられます。)
1252
1253 @item
1254 Vertically, the symbol is placed next to the note and the staff.
1255
1256 (垂直方向では、この記号は音符や譜の近く配置されます。)
1257
1258 @item
1259 The vertical position is also coordinated with other superscript
1260 and subscript symbols.
1261
1262 (また、垂直方向の位置は、他の上付き記号や下付き記号との調整によって決まります。)
1263 @end itemize
1264
1265 これらの側面はそれぞれ、いわゆる @emph{インターフェイス}
1266 として捉ええられます。@c
1267 それらは、@rinternals{Fingering} ページの最下部でリストアップされています。
1268
1269 @quotation
1270 This object supports the following interfaces:
1271
1272 (このオブジェクトは以下のインターフェイスをサポートします:)
1273
1274 @rinternals{item-interface},
1275 @rinternals{self-alignment-interface},
1276 @rinternals{side-position-interface}, @rinternals{text-interface},
1277 @rinternals{text-script-interface}, @rinternals{font-interface},
1278 @rinternals{finger-interface}, and @rinternals{grob-interface}.
1279 @end quotation
1280
1281 リンクのいずれかをクリックすると、@c
1282 それぞれのオブジェクト インターフェイスのページに行くことができます。@c
1283 各インターフェイスはいくつかのプロパティを持ちます。@c
1284 それらプロパティの中には、ユーザにとって役に立たないもの
1285 (@q{内部プロパティ}) もありますが、それ以外は変更可能です。
1286
1287 これまで @code{Fingering} オブジェクトについて話してきましたが、@c
1288 これは実際にはそれほど多くのことをしているわけではありません。@c
1289 初期化ファイル (@rlearning{その他の情報源} を参照してください)
1290 @file{scm/define-grobs.scm} がこの @q{オブジェクト} の本質を示しています:
1291
1292 @example
1293 (Fingering
1294   . ((padding . 0.5)
1295      (avoid-slur . around)
1296      (slur-padding . 0.2)
1297      (staff-padding . 0.5)
1298      (self-alignment-X . 0)
1299      (self-alignment-Y . 0)
1300      (script-priority . 100)
1301      (stencil . ,ly:text-interface::print)
1302      (direction . ,ly:script-interface::calc-direction)
1303      (font-encoding . fetaText)
1304      (font-size . -5)           ; don't overlap when next to heads.
1305      (meta . ((class . Item)
1306      (interfaces . (finger-interface
1307                     font-interface
1308                     text-script-interface
1309                     text-interface
1310                     side-position-interface
1311                     self-alignment-interface
1312                     item-interface))))))
1313 @end example
1314
1315 @noindent
1316 見て取ることができるように、@c
1317 @code{Fingering} オブジェクトは変数設定の塊に過ぎず、@c
1318 内部リファレンスの中にある Web ページは、@c
1319 この定義から直接生成されたに過ぎません。
1320
1321
1322 @node グラフィカル オブジェクトを決定する
1323 @subsection グラフィカル オブジェクトを決定する
1324 @translationof Determining the grob property
1325
1326 @c TODO remove this (it's in the LM)
1327 @c Replace with more factual directions
1328
1329 以下の @b{2} の位置を変更しようとしていたことを思い出してください:
1330
1331 @lilypond[quote,fragment,relative=2,verbatim]
1332 c-2
1333 \stemUp
1334 f
1335 @end lilypond
1336
1337 垂直方向で見て、@b{2} は元の音符の隣に配置されるのですから、@c
1338 この配置に関連するインターフェイスに干渉する必要があります。@c
1339 これは @code{side-position-interface} を用いて行います。@c
1340 このインターフェイスについてのページには、以下のように記述されています:
1341
1342 @quotation
1343 @code{side-position-interface}
1344
1345 Position a victim object (this one) next to other objects (the
1346 support).  The property @code{direction} signifies where to put the
1347 victim object relative to the support (left or right, up or down?)
1348
1349 (対象オブジェクトを他のオブジェクト (サポート オブジェクト)
1350 の隣に配置します。@c
1351 このプロパティ @code{direction} は、@c
1352 対象オブジェクトをどこに配置するかを@c
1353 サポート オブジェクトからの相対位置で示します
1354 (左あるいは右、上あるいは下?))
1355 @end quotation
1356
1357 @cindex padding
1358 @noindent
1359 この記述の下に、以下のような変数 @code{padding} についての記述があります:
1360
1361 @quotation
1362 @table @code
1363 @item padding
1364 (dimension, in staff space)
1365 (譜スペースを単位とする距離)
1366
1367 Add this much extra space between objects that are next to each other.
1368 (隣り合うオブジェクトの間にスペースを付け加えます)
1369 @end table
1370 @end quotation
1371
1372 @code{padding} の値を増やすことで、@c
1373 運指記号を符頭から離すことができます。@c
1374 以下のコマンドは、音符と運指記号の間に 3 譜スペースを挿入します:
1375
1376 @example
1377 \once \override Voice.Fingering #'padding = #3
1378 @end example
1379
1380 このコマンドを @code{Fingering} オブジェクトが作成される前に挿入する
1381 -- つまり @code{c2} の前に挿入する -- と、以下のような結果が得られます:
1382
1383 @lilypond[quote,relative=2,fragment,verbatim]
1384 \once \override Voice.Fingering #'padding = #3
1385 c-2
1386 \stemUp
1387 f
1388 @end lilypond
1389
1390
1391 このケースでは、調整されるコンテキストは @code{Voice} です。@c
1392 このことは、内部リファレンスの @rinternals{Fingering_engraver}
1393 プラグインについてのページからわかります。@c
1394 このページには、以下のような記述があります:
1395
1396 @quotation
1397 Fingering_engraver is part of contexts: @dots{} @rinternals{Voice}
1398 (Fingering_engraver は次のコンテキストの一部です: @dots{} @rinternals{Voice})
1399 @end quotation
1400
1401
1402 @node 命名規約
1403 @subsection 命名規約
1404 @translationof Naming conventions
1405
1406 内部リファレンスについて他に説明しておくべき事柄として、@c
1407 さまざまな命名規約についての概要があります:
1408
1409 @itemize
1410 @item Scheme スタイル: 小文字の単語をハイフンでつなぎます
1411 (1 単語の名前を含みます) -- 例: lowercase-with-hyphens
1412 @item Scheme 関数: Scheme スタイルの先頭に @code{ly:} を付けます
1413 -- 例: ly:plus-scheme-style
1414 @item 音楽イベント、音楽クラス、それに音楽プロパティ: Scheme スタイルです
1415 -- 例: as-scheme-functions
1416 @item グラフィカル オブジェクト インターフェイス: Scheme スタイルです
1417 -- 例: scheme-style
1418 @c 未訳
1419 @item バックエンド プロパティ: Scheme スタイルです (が、X と Y があります!)
1420 @item コンテキスト (それに、音楽表記とグラフィカル オブジェクト):
1421 大文字で始まる単語、あるいはそれらをつなげます
1422 -- 例: Capitalized, CamelCase
1423 @item コンテキスト プロパティ:
1424 小文字で始まる単語に、大文字で始まる単語をつなげます
1425 -- 例: lowercaseFollowedByCamelCase
1426 @item エングラーバ:
1427 大文字で始まる単語に、小文字で始まる単語をアンダスコアでつなげます
1428 -- 例: Capitalized_followed_by_lowercase_and_with_underscores
1429 @end itemize
1430
1431 疑問:
1432 @itemize
1433 @item 命名規約のうち、慣習なのはどれで、規則なのはどれか?
1434 @item 命名規約のうち、どれが基本言語の規則で、@c
1435 どれが LP (訳者: LilyPond?) 特有の規則なのか?
1436 @end itemize
1437
1438
1439 @node プロパティを変更する
1440 @section プロパティを変更する
1441 @translationof Modifying properties
1442
1443 @c TODO change the menu and subsection node names to use
1444 @c backslash once the new macro to handle the refs
1445 @c is available.  Need to find and change all refs at
1446 @c the same time. -td
1447
1448 @menu
1449 * プロパティ変更の概要::
1450 * set コマンド::
1451 * override コマンド::
1452 * tweak コマンド::
1453 * set 対 override::
1454 * 連想配列を変更する::
1455 @end menu
1456
1457
1458 @node プロパティ変更の概要
1459 @subsection プロパティ変更の概要
1460 @translationof Overview of modifying properties
1461
1462 各コンテキストは、ある特定のタイプのグラフィカル オブジェクトを作成することに@c
1463 ついて責任を持ちます。@c
1464 それらのオブジェクトを表示するために使用される設定も、@c
1465 コンテキストによって保存されます。@c
1466 それらの設定を変更することにより、オブジェクトの見た目を変えることができます。
1467
1468 コンテキストに保存されるプロパティには 2 種類あります:
1469 コンテキスト プロパティとグラフィカル オブジェクト プロパティです。@c
1470 コンテキスト プロパティは、コンテキスト全体に適用され、@c
1471 コンテキスト自体をどのように表示するかを制御します。@c
1472 対照的に、グラフィカル オブジェクト プロパティは、コンテキストの中に表示される@c
1473 ある特定のタイプのグラフィカル オブジェクトに適用されます。
1474
1475 @code{\set} コマンドと @code{\unset} コマンドは、@c
1476 コンテキスト プロパティの値を変更するために使用されます。@c
1477 @code{\override} コマンドと @code{\revert} コマンドは、@c
1478 グラフィカル オブジェクト プロパティの値を変更するために使用されます。
1479
1480 @ignore
1481 The syntax for this is
1482
1483 @example
1484 \override @var{context}.@var{name} #'@var{property} = #@var{value}
1485 @end example
1486
1487 Here @var{name} is the name of a graphical object, like
1488 @code{Stem} or @code{NoteHead}, and @var{property} is an internal
1489 variable of the formatting system (@q{grob property} or @q{layout
1490 property}).  The latter is a symbol, so it must be quoted.  The
1491 subsection @ref{Modifying properties}, explains what to fill in
1492 for @var{name}, @var{property}, and @var{value}.  Here we only
1493 discuss the functionality of this command.
1494
1495 The command
1496
1497 @verbatim
1498 \override Staff.Stem #'thickness = #4.0
1499 @end verbatim
1500
1501 @noindent
1502 makes stems thicker (the default is 1.3, with staff line thickness as a
1503 unit).  Since the command specifies @code{Staff} as context, it only
1504 applies to the current staff.  Other staves will keep their normal
1505 appearance.  Here we see the command in action:
1506
1507 @lilypond[quote,verbatim,relative=2,fragment]
1508 c4
1509 \override Staff.Stem #'thickness = #4.0
1510 c4
1511 c4
1512 c4
1513 @end lilypond
1514
1515 The @code{\override} command changes the definition of the @code{Stem}
1516 within the current @code{Staff}.  After the command is interpreted
1517 all stems are thickened.
1518
1519 Analogous to @code{\set}, the @var{context} argument may be left out,
1520 causing the default context @code{Voice} to be used.  Adding
1521 @code{\once} applies the change during one timestep only.
1522
1523 @lilypond[quote,fragment,verbatim,relative=2]
1524 c4
1525 \once \override Stem #'thickness = #4.0
1526 c4
1527 c4
1528 @end lilypond
1529
1530 The @code{\override} must be done before the object is
1531 started.  Therefore, when altering @emph{Spanner} objects such as slurs
1532 or beams, the @code{\override} command must be executed at the moment
1533 when the object is created.  In this example,
1534
1535 @lilypond[quote,fragment,verbatim,relative=2]
1536 \override Slur #'thickness = #3.0
1537 c8[( c
1538 \override Beam #'thickness = #0.6
1539 c8 c])
1540 @end lilypond
1541
1542 @noindent
1543 the slur is fatter but the beam is not.  This is because the command for
1544 @code{Beam} comes after the Beam is started, so it has no effect.
1545
1546 Analogous to @code{\unset}, the @code{\revert} command for a context
1547 undoes an @code{\override} command; like with @code{\unset}, it only
1548 affects settings that were made in the same context.  In other words, the
1549 @code{\revert} in the next example does not do anything.
1550
1551 @example
1552 \override Voice.Stem #'thickness = #4.0
1553 \revert Staff.Stem #'thickness
1554 @end example
1555
1556 Some tweakable options are called @q{subproperties} and reside inside
1557 properties.  To tweak those, use commands of the form
1558
1559 @c leave this as a long long
1560 @example
1561 \override @var{context}.@var{name} #'@var{property} #'@var{subproperty} = #@var{value}
1562 @end example
1563
1564 @noindent
1565 such as
1566
1567 @example
1568 \override Stem #'(details beamed-lengths) = #'(4 4 3)
1569 @end example
1570
1571 @end ignore
1572
1573 @seealso
1574 内部リファレンス:
1575 @rinternals{Backend},
1576 @rinternals{All layout objects},
1577 @rinternals{OverrideProperty},
1578 @rinternals{RevertProperty},
1579 @rinternals{PropertySet}
1580
1581
1582 @knownissues
1583
1584 バックエンドはオブジェクト プロパティのタイプ チェックを@c
1585 それほど厳密には行いません。@c
1586 Scheme 値の循環参照は、ハング アップまたはクラッシュ、@c
1587 あるいは両方を引き起こす可能性があります。
1588
1589
1590
1591 @node set コマンド
1592 @subsection @code{\set} コマンド
1593 @translationof The set command
1594
1595 @cindex properties (プロパティ)
1596 @funindex \set
1597 @cindex changing properties (プロパティを変更する)
1598
1599 各コンテキストは @emph{プロパティ} の集合を持ちます。@c
1600 プロパティとは、コンテキストの中に保持されている変数です。@c
1601 コンテキスト プロパティは、@code{\set} コマンドによって変更されます。@c
1602 @code{\set} コマンドは以下のような構文を持ちます:
1603
1604 @example
1605 \set @var{context}.@var{property} = #@var{value}
1606 @end example
1607
1608 @var{value} は Scheme オブジェクトですので、@c
1609 @code{#} 文字を前に置く必要があります。
1610
1611 通常、コンテキスト プロパティの名前は、@c
1612 小文字で始まる単語に大文字で始まる単語をつなげたものです。@c
1613 これらはたいてい音楽から記譜への翻訳を制御します
1614 -- 例えば、@code{localKeySignature} (臨時記号を表示するかどうかを決定します)
1615 や、@code{measurePosition} (小節線を表示するタイミングを決定します) です。@c
1616 コンテキスト プロパティは、楽曲の解釈をしている間、@c
1617 ずっと値を変更しておくことができます。@c
1618 @code{measurePosition} がその良い例です。@c
1619 コンテキスト プロパティは @code{\set} で変更されます。
1620
1621 例えば、コンテキスト プロパティ @code{skipBars} が
1622 @code{#t} にセットされていれば、@c
1623 複小節休符は 1 つの小節に統合されます:
1624
1625 @lilypond[quote,verbatim,relative=2,fragment]
1626 R1*2
1627 \set Score.skipBars = ##t
1628 R1*2
1629 @end lilypond
1630
1631 @var{context} 引数が省略されている場合、@c
1632 プロパティはカレントの最下位のコンテキストにセットされます
1633 (一般に、@code{ChordNames}, @code{Voice}, @code{TabVoice},
1634 あるいは @code{Lyrics} です)。
1635
1636 @lilypond[quote,verbatim,relative=2]
1637 \set Score.autoBeaming = ##f
1638 <<
1639   {
1640     e8 e e e
1641     \set autoBeaming = ##t
1642     e8 e e e
1643   } \\ {
1644     c8 c c c c8 c c c
1645   }
1646 >>
1647 @end lilypond
1648
1649 変更は @q{オンザフライ} (その場、その時々) で適用されるため、@c
1650 設定 @code{\set autoBeaming = ##t} は 2 番目の 8 分音符グループだけに@c
1651 効果を持ちます。
1652
1653 最下位コンテキストが常に変更しようとしているプロパティを持っているとは@c
1654 限らないということに注意してください
1655 -- 例えば、@code{skipBars} プロパティをデフォルトの最下位コンテキスト
1656 (この場合は、@code{Voice} です) にセットしようと試みても、効果はありません。@c
1657 なぜなら、@code{skipBars} は @code{Score} コンテキストのプロパティだからです。
1658
1659 @lilypond[quote,verbatim,relative=2]
1660 R1*2
1661 \set skipBars = ##t
1662 R1*2
1663 @end lilypond
1664
1665 コンテキストは階層構造をとるため、音楽表記を囲っているコンテキスト
1666 -- 例えば、@code{Staff} -- が指定された場合、@c
1667 変更はカレントの @code{Staff} の中にあるすべての @code{Voice} に適用されます。
1668
1669 @funindex \unset
1670
1671 @code{\unset} コマンド:
1672
1673 @example
1674 \unset @var{context}.@var{property}
1675 @end example
1676
1677 @noindent
1678 は、@var{context} から @var{property} の定義を削除するために使用されます。@c
1679 このコマンドは、@var{context} の中にセットされた場合にのみ、定義を削除します。@c
1680 音楽表記を囲っているコンテキストにセットされたプロパティは、@c
1681 囲まれているコンテキストの中にある @code{\unset} では変更されません:
1682
1683 @lilypond[quote,verbatim,relative=2]
1684 \set Score.autoBeaming = ##t
1685 <<
1686   {
1687     \unset autoBeaming
1688     e8 e e e
1689     \unset Score.autoBeaming
1690     e8 e e e
1691   } \\ {
1692     c8 c c c c8 c c c
1693   }
1694 >>
1695 @end lilypond
1696
1697 @code{\set} と同様に、
1698 最下位コンテキストに対しては @var{context} 引数を指定する必要はありません。@c
1699 ですから、以下の 2 つの記述:
1700
1701 @example
1702 \set Voice.autoBeaming = ##t
1703 \set autoBeaming = ##t
1704 @end example
1705
1706 @noindent
1707 は、カレントの最下位コンテキストが @code{Voice} であれば、等価です。
1708
1709
1710 @cindex \once
1711 @code{\set} の前に @code{\once} を置くと、@c
1712 その設定は単一の時間ステップにだけ適用されます:
1713
1714 @lilypond[quote,verbatim,relative=2]
1715 c4
1716 \once \set fontSize = #4.7
1717 c4
1718 c4
1719 @end lilypond
1720
1721 利用可能なすべてのコンテキスト プロパティについての完全な記述は、@c
1722 内部リファレンスにあります。@c
1723 以下を参照してください:
1724 @ifhtml
1725 @rinternals{Tunable context properties}.
1726 @end ifhtml
1727 @ifnothtml
1728 Translation @expansion{} Tunable context properties.
1729 @end ifnothtml
1730
1731 @seealso
1732
1733 内部リファレンス:
1734
1735 @rinternals{Tunable context properties}
1736
1737
1738 @cindex grob properties (グラフィカル オブジェクト プロパティ)
1739 @cindex properties, grob (グラフィカル オブジェクト プロパティ)
1740 @funindex \override
1741
1742
1743 @node override コマンド
1744 @subsection @code{\override} コマンド
1745 @translationof The override command
1746
1747 特殊なタイプのコンテキスト プロパティがあります:
1748 グラフィカル オブジェクト記述です。@c
1749 グラフィカル オブジェクト記述には @code{StudlyCaps} という名前
1750 (大文字で始まります) が付けられています。@c
1751 これらは、関連リストとして、ある特定の種類のグラフィカル オブジェクト用の
1752 @q{デフォルト設定} を保持します。@c
1753 各グラフィカル オブジェクト記述の設定を調べるには、@c
1754 @file{scm/define-grobs.scm} を参照してください。@c
1755 各グラフィカル オブジェクト記述は @code{\override} を用いて変更します。
1756
1757 @code{\override} は、実際のところ、簡略化した記述です。
1758
1759 @example
1760 \override @var{context}.@var{GrobName} #'@var{property} = #@var{value}
1761 @end example
1762
1763 @noindent
1764 これは、以下と等価です:
1765
1766 @c  leave this long line -gp
1767 @example
1768 \set @var{context}.@var{GrobName}  =
1769   #(cons (cons '@var{property} @var{value})
1770          <previous value of @var{context}.@var{GrobName}>)
1771 @end example
1772
1773 @code{context}.@code{GrobName} (alist) の値は、@c
1774 個々のグラフィカル オブジェクトのプロパティを初期化するために使用されます。@c
1775 グラフィカル オブジェクトは、Scheme スタイルの名前
1776 (小文字の単語を @code{-} でつないだもの) のプロパティを持ちます。@c
1777 グラフィカル オブジェクト プロパティの値は、@c
1778 フォーマット処理の間ずっと変更されています:
1779 基本的に、フォーマット処理は、@c
1780 コールバック関数を用いてプロパティを計算することに他なりません。@c
1781
1782 例えば、@code{Stem} オブジェクトの @code{thickness} プロパティを@c
1783 オーバライドすることによって、符幹の太さを太くすることができます:
1784
1785 @lilypond[quote,verbatim,relative=2]
1786 c4 c
1787 \override Voice.Stem #'thickness = #3.0
1788 c4 c
1789 @end lilypond
1790
1791 If no context is specified in an @code{\override}, the bottom
1792 context is used:
1793
1794 @lilypond[quote,verbatim,relative=2]
1795 { \override Staff.Stem #'thickness = #3.0
1796   <<
1797     {
1798       e4 e
1799       \override Stem #'thickness = #0.5
1800       e4 e
1801     } \\ {
1802       c4 c c c
1803     }
1804   >>
1805 }
1806 @end lilypond
1807
1808 @funindex \revert
1809 @cindex reverting overrides (オーバライドを元に戻す)
1810 @cindex overrides, reverting (オーバライドを元に戻す)
1811
1812 @code{\override} の効果は、@code{\revert} によって元に戻すことができます:
1813
1814 @lilypond[quote,verbatim,relative=2]
1815 c4
1816 \override Voice.Stem #'thickness = #3.0
1817 c4 c
1818 \revert Voice.Stem #'thickness
1819 c4
1820 @end lilypond
1821
1822 @code{\override} と @code{\revert} の効果は、@c
1823 その時点から影響を受けるコンテキストの中にある@c
1824 すべてのグラフィカル オブジェクトに適用されます:
1825
1826 @lilypond[quote,verbatim,relative=2]
1827 {
1828   <<
1829     {
1830       e4
1831       \override Staff.Stem #'thickness = #3.0
1832       e4 e e
1833     } \\ {
1834       c4 c c
1835       \revert Staff.Stem #'thickness
1836       c4
1837     }
1838   >>
1839 }
1840 @end lilypond
1841
1842 @funindex \once
1843 @cindex overriding for only one moment (一時的にオーバライドする)
1844
1845 @code{\once} を @code{\override} と共に用いることで、@c
1846 カレントの時間ステップだけに効果を与えることができます:
1847
1848 @lilypond[quote,verbatim,relative=2]
1849 {
1850   <<
1851     {
1852       \override Stem #'thickness = #3.0
1853       e4 e e e
1854     } \\ {
1855       c4
1856       \once \override Stem #'thickness = #3.0
1857       c4 c c
1858     }
1859   >>
1860 }
1861 @end lilypond
1862
1863
1864 @ignore
1865 Commands which change output generally look like
1866
1867 @example
1868 \override Voice.Stem #'thickness = #3.0
1869 @end example
1870
1871 @noindent
1872 To construct this tweak we must determine these bits of information:
1873
1874 @itemize
1875 @item the context: here @code{Voice}.
1876 @item the layout object: here @code{Stem}.
1877 @item the layout property: here @code{thickness}.
1878 @item a sensible value: here @code{3.0}.
1879 @end itemize
1880
1881 Some tweakable options are called @q{subproperties} and reside inside
1882 properties.  To tweak those, use commands in the form
1883
1884 @example
1885 \override Stem #'(details beamed-lengths) = #'(4 4 3)
1886 @end example
1887
1888 @cindex internal documentation
1889 @cindex finding graphical objects
1890 @cindex graphical object descriptions
1891 @cindex tweaking
1892 @funindex \override
1893 @cindex internal documentation
1894
1895 For many properties, regardless of the data type of the property, setting the
1896 property to false ( @code{##f} ) will result in turning it off, causing
1897 LilyPond to ignore that property entirely.  This is particularly useful for
1898 turning off grob properties which may otherwise be causing problems.
1899
1900 We demonstrate how to glean this information from the notation manual
1901 and the program reference.
1902 @end ignore
1903
1904 @seealso
1905
1906 内部リファレンス:
1907 @rinternals{Backend}
1908
1909
1910 @node tweak コマンド
1911 @subsection @code{\tweak} コマンド
1912 @translationof The tweak command
1913
1914 @funindex \tweak
1915 @cindex tweaking (調整)
1916
1917 @code{\tweak} を用いたグラフィカル オブジェクト プロパティの変更は、@c
1918 コンテキストの中にあるすべてのグラフィカル オブジェクトに適用されます。@c
1919 しかしながら、@c
1920 影響を受けるコンテキストの中にあるすべてのグラフィカル オブジェクトではなく、@c
1921 1 つのグラフィカル オブジェクトだけに変更を適用したい場合もあります。@c
1922 そうするには、@code{\tweak} コマンドを用います。@c
1923 @code{\tweak} コマンドは以下のような構文を持ちます:
1924
1925 @example
1926 \tweak #'@code{grob-property} #@code{value}
1927 @end example
1928
1929 @code{\tweak} コマンドは、音楽の流れの中で
1930 @code{value} のすぐ後に現れるオブジェクトに変更を適用します。
1931
1932 @ignore
1933 In some cases, it is possible to take a short-cut for tuning
1934 graphical objects.  For objects that are created directly from
1935 an item in the input file, you can use the @code{\tweak} command.
1936 For example:
1937
1938 @lilypond[relative=2,verbatim,quote]
1939 < c
1940   \tweak #'color #red
1941   d
1942   g
1943   \tweak #'duration-log #1
1944   a
1945 > 4
1946 -\tweak #'padding #8
1947 -^
1948 @end lilypond
1949
1950
1951
1952 But the main use of the @code{\tweak} command is to modify just
1953 one of a number of notation elements which start at the same musical
1954 moment, like the notes of a chord, or tuplet brackets which start
1955 at the same time.
1956
1957 The @code{\tweak} command sets a property in the following object
1958 directly, without requiring the grob name or context to be
1959 specified.  For this to work, it is necessary for the @code{\tweak}
1960 command to remain immediately adjacent to the object to which it is
1961 to apply after the input file has been converted to a music stream.
1962 This is often not the case, as many additional elements are inserted
1963 into the music stream implicitly.  For example, when a note which is
1964 not part of a chord is processed, LilyPond implicitly inserts a
1965 @code{ChordEvent} event before the note, so separating the tweak
1966 from the note.  However, if chord symbols are placed round the
1967 tweak and the note, the @code{\tweak} command comes after the
1968 @code{ChordEvent} in the music stream, so remaining adjacent to the
1969 note, and able to modify it.
1970
1971 So, this works:
1972
1973 @lilypond[relative=2,verbatim,quote]
1974 <\tweak #'color #red c>4
1975 @end lilypond
1976
1977 @noindent
1978 but this does not:
1979
1980 @lilypond[relative=2,verbatim,quote]
1981 \tweak #'color #red c4
1982 @end lilypond
1983
1984 @end ignore
1985
1986 調整コマンドの構文と使用方法についての紹介は、@c
1987 @rlearning{調整手段} を参照してください。
1988
1989 同じようなオブジェクトがいくつか、同じ音楽タイミングで配置されている場合、@c
1990 @code{\override} コマンドでそれらの 1 つだけを変更することはできません
1991 -- @code{\tweak} コマンドを用いる必要があります。@c
1992 同じ音楽タイミングで複数出現する可能性があるオブジェクトには、@c
1993 以下のようなものがあります:
1994
1995 @c TODO expand to include any further uses of \tweak
1996 @itemize
1997 @item 和音の中にある音符の符頭
1998 @item 1 つの音符に付けられるアーティキュレーション記号
1999 @item 和音の中にある音符の間に付けられるタイ
2000 @item 同時に始まる連符の囲み
2001 @end itemize
2002
2003 @c TODO add examples of these
2004
2005 @cindex chord, modifying one note in (和音の中にある音符の 1 つを変更する)
2006
2007 以下の例では、和音の中にある符頭の 1 つの色を変更し、@c
2008 さらに他の符頭のタイプを変更しています:
2009
2010 @lilypond[relative=2,verbatim,quote]
2011 < c
2012   \tweak #'color #red
2013   d
2014   g
2015   \tweak #'duration-log #1
2016   a
2017 > 4
2018 @end lilypond
2019
2020 @code{\tweak} を用いて、スラーを変更することができます:
2021
2022 @lilypond[verbatim,quote,relative=1]
2023 c-\tweak #'thickness #5 ( d e f)
2024 @end lilypond
2025
2026
2027 @code{\tweak} コマンドが機能するためには、@c
2028 入力ファイルが音楽の流れに変換されたときに、@c
2029 @code{\tweak} コマンドのすぐ後に@c
2030 変更が適用されるオブジェクトが配置されている必要があります。
2031 LilyPond は、構文解釈処理時に、@c
2032 追加のオブジェクトを音楽の流れの中に挿入する場合があります。@c
2033 例えば、明示的には和音の一部になっていない音符を、@c
2034 LilyPond が音符の中に配置する場合があります。@c
2035 そのため、@code{\tweak} で変更される音符は、@c
2036 和音構造の中に配置されている必要があります:
2037
2038 @lilypond[relative=2,verbatim,quote]
2039 \tweak #'color #red c4
2040 <\tweak #'color #red c>4
2041 @end lilypond
2042
2043 @code{\tweak} コマンドは、@c
2044 入力ファイルの中で明示的に記述されていないオブジェクトを@c
2045 変更するために用いることはできません。@c
2046 特に、符幹、連桁、あるいは臨時記号を直接変更することはできません。@c
2047 なぜなら、それらは入力の中にある音楽要素の後ではなく、@c
2048 符頭の後に生成されるからです。@c
2049 さらに、音部記号や拍子記号を変更することもできません。@c
2050 なぜなら、コンテキストを指定するために必要とされる追加要素の自動挿入により、@c
2051 それらは前に配置された @code{\tweak} コマンドとは分離されるからです。@c
2052
2053 記譜要素の前に複数の @code{\tweak} コマンドを配置することができます
2054 -- それらはすべて効果を持ちます:
2055
2056 @lilypond[verbatim,quote,relative=1]
2057 c
2058 -\tweak #'style #'dashed-line
2059 -\tweak #'dash-fraction #0.2
2060 -\tweak #'thickness #3
2061 -\tweak #'color #red
2062  \glissando
2063 f'
2064 @end lilypond
2065
2066 入力ファイルのあるセクションから生成される音楽の流れ
2067 -- 自動的に挿入される要素も含めて --
2068 が、検証されます。@c
2069 @rextend{Displaying music expressions} を参照してください。@c
2070 これは、@code{\tweak} コマンドによって変更されるオブジェクトを決定するとき、@c
2071 あるいは、@c
2072 @code{\tweak} の適用で入力を調整する方法を決定するときに役に立つかもしれません。
2073
2074
2075 @seealso
2076 学習マニュアル:
2077 @rlearning{調整手段}
2078
2079 拡張:
2080 @rextend{Displaying music expressions}
2081
2082
2083 @knownissues
2084
2085 @cindex tweaks in a variable (変数の中での調整)
2086 @code{\tweak} コマンドを変数の中で用いることはできません。
2087
2088 @cindex tweaks in lyrics (歌詞の中での調整)
2089 @code{\tweak} コマンドを @code{\lyricmode} の中で用いることはできません。
2090
2091 @cindex tweaking control points (制御ポイントを調整する)
2092 @cindex control points, tweaking (制御ポイントを調整する)
2093
2094 @code{\tweak} コマンドは、和音の中で生成される複数のタイのうち、@c
2095 最初のタイだけに適用されます。
2096
2097
2098 @node set 対 override
2099 @subsection @code{\set} 対 @code{\override}
2100 @translationof set versus override
2101
2102 TODO -- This section is probably unnecessary now.
2103
2104 @ignore
2105 We have seen two methods of changing properties: @code{\set} and
2106 @code{\override}.  There are actually two different kinds of
2107 properties.
2108
2109 @code{fontSize} is a special property: it is equivalent to
2110 entering @code{\override ... #'font-size} for all pertinent
2111 objects.  Since this is a common change, the special
2112 property (modified with @code{\set}) was created.
2113
2114 @end ignore
2115
2116
2117 @node 連想配列を変更する
2118 @subsection 連想配列を変更する
2119 @translationof Modifying alists
2120
2121 ユーザが変更可能なプロパティの中には、@c
2122 内部的には @emph{連想配列} として存在しているものがあります
2123 -- 連想配列は @emph{キー} と @emph{値} のペアの配列を保持します。@c
2124 連想配列の構造は下記のとおりです:
2125
2126 @example
2127 '((@var{キー1} . @var{値1})
2128   (@var{キー2} . @var{値2})
2129   (@var{キー3} . @var{値3})
2130   @dots{})
2131 @end example
2132
2133 ある連想配列がグラフィカル オブジェクト プロパティまたは
2134 @code{\paper} 変数である場合、@c
2135 その連想配列の個々のキーを、他のキーに影響を与えることなく、@c
2136 変更することができます。
2137
2138 例えば、譜グループの中にある隣り合う譜間のスペースを減らすには、@c
2139 @code{StaffGrouper} グラフィカル オブジェクトの
2140 @code{staff-staff-spacing} プロパティを使用します。@c
2141 このプロパティは 4 つのキー
2142 -- @code{basic-distance}, @code{minimum-distance},
2143 @code{padding}, それに @code{stretchability} --
2144 を持つ連想配列です。@c
2145 このプロパティの標準設定は、@c
2146 内部リファレンスの @qq{Backend} セクションでリストアップされています
2147 (@rinternals{StaffGrouper} を参照してください):
2148
2149 @example
2150 '((basic-distance . 9)
2151   (minimum-distance . 7)
2152   (padding . 1)
2153   (stretchability . 5))
2154 @end example
2155
2156 譜間のスペースを小さくする方法の 1 つは、@c
2157 @code{basic-distance} キーの値 (@code{9}) を
2158 @code{minimum-distance} キーの値 (@code{7}) 近くまで減らすことです。@c
2159 個々のキーを変更するには、@emph{ネストされた宣言} を使います:
2160
2161 @c KEEP LY
2162 @lilypond[quote,verbatim]
2163 % デフォルトの譜間スペース
2164 \new PianoStaff <<
2165   \new Staff { \clef treble c''1 }
2166   \new Staff { \clef bass   c1   }
2167 >>
2168
2169 % 譜間スペースを減らします
2170 \new PianoStaff \with {
2171   % this is the nested declaration
2172   \override StaffGrouper #'staff-staff-spacing #'basic-distance = #7
2173 } <<
2174   \new Staff { \clef treble c''1 }
2175   \new Staff { \clef bass   c1   }
2176 >>
2177 @end lilypond
2178
2179 ネストされた宣言は、プロパティの他のキーに変更を加えることなく、@c
2180 指定されたキー (上の例では @code{basic-distance}) を更新します。
2181
2182 今度は、譜を重ならない範囲でできる限り近づけたいとします。@c
2183 最も簡単な方法は、連想配列の 4 つのキーすべてを 0 にセットすることです。@c
2184 しかしながら、4 つのネストされた宣言を記述する必要はありません。@c
2185 1 つの宣言でプロパティを丸ごと再定義することができます:
2186
2187 @lilypond[quote,verbatim]
2188 \new PianoStaff \with {
2189   \override StaffGrouper #'staff-staff-spacing =
2190     #'((basic-distance . 0)
2191        (minimum-distance . 0)
2192        (padding . 0)
2193        (stretchability . 0))
2194 } <<
2195   \new Staff { \clef treble c''1 }
2196   \new Staff { \clef bass   c1   }
2197 >>
2198 @end lilypond
2199
2200 連想配列の再定義でリストアップされなかったキーは、@c
2201 @emph{セットされなかった場合のデフォルト値} にリセットされます。@c
2202 @code{staff-staff-spacing} の場合、@c
2203 セットされなかったキーは 0 にリセットされます
2204 (@code{stretchability} は例外で、セットされなかった場合、@c
2205 @code{basic-distance} にリセットされます)。@c
2206 このため、以下の 2 つの宣言は等価です:
2207
2208 @example
2209 \override StaffGrouper #'staff-staff-spacing =
2210   #'((basic-distance . 7))
2211
2212 \override StaffGrouper #'staff-staff-spacing =
2213   #'((basic-distance . 7)
2214      (minimum-distance . 0)
2215      (padding . 0)
2216      (stretchability . 7))
2217 @end example
2218
2219 連想配列の再定義でリストアップされなかったキーがあることにより、@c
2220 初期化ファイルでセットされたり、@c
2221 入力ファイルがコンパイルされるときに読み込まれた@c
2222 標準設定が (意図せずに) 削除される可能性があります。@c
2223 上の例では、@code{padding} と @code{minimum-distance} の標準設定
2224 (@file{scm/define-grobs.scm} で定義されます) は、@c
2225 @emph{セットされなかった場合のデフォルト値} (両方とも 0) にリセットされます。@c
2226 プロパティや (任意のサイズ) 連想配列を定義した場合、@c
2227 セットされなかったキー値はすべて @emph{セットされなかった場合のデフォルト値}
2228 にリセットされます。@c
2229 そうすることを意図しているのでない限り、@c
2230 ネストされた宣言を用いてキー値を個々に更新する方が安全です。
2231
2232 @warning{ネストされた宣言は、コンテキスト プロパティ連想配列
2233 (@code{beamExceptions}, @code{keySignature}, @code{timeSignatureSettings} 等)
2234 に対しては機能しません。@c
2235 これらのプロパティを変更するには、@c
2236 連想配列として丸ごと再定義するしかありません。}
2237
2238
2239 @node 役に立つコンセプトとプロパティ
2240 @section 役に立つコンセプトとプロパティ
2241 @translationof Useful concepts and properties
2242
2243 @menu
2244 * 入力モード::
2245 * 向きと配置::
2246 * コンテキスト レイアウトの順序::
2247 * 距離と距離の単位::
2248 * 譜記号プロパティ::
2249 * スパナ::
2250 * オブジェクトの可視性::
2251 * ライン スタイル::
2252 * オブジェクトを回転させる::
2253 @end menu
2254
2255
2256 @node 入力モード
2257 @subsection 入力モード
2258 @translationof Input modes
2259
2260 入力ファイルの中に保持されている記譜を解釈する方法は、@c
2261 カレントの入力モードによって決定されます。
2262
2263 @strong{コード モード}
2264
2265 このモードは @code{\chordmode} コマンドで有効になり、@c
2266 入力はコード記譜法の構文で解釈されるようになります。@c
2267 @ref{Chord notation} を参照してください。@c
2268 コードは、譜面上に音符として描画されます。
2269
2270 コード モードは @code{\chords} コマンドでも有効になります。@c
2271 このコマンドは新たに @code{ChordNames} コンテキストも作成します。@c
2272 入力はコード記譜法の構文で解釈され、@c
2273 さらに @code{ChordNames} コンテキストの中にコード ネームとして描画されます。@c
2274 @ref{Printing chord names} を参照してください。
2275
2276 @strong{ドラム モード}
2277
2278 このモードは @code{\drummode} コマンドで有効になり、@c
2279 入力はドラム記譜法の構文で解釈されるようになります。@c
2280 @ref{Basic percussion notation} を参照してください。
2281
2282 また、ドラム モードは @code{\drums} コマンドでも有効になります。@c
2283 このモードも新たに @code{DrumStaff} コンテキストを作成し、@c
2284 コマンドの後に続く入力をドラム記譜法の構文で解釈して、@c
2285 ドラム譜上にドラム記号として描画します。@c
2286 @ref{Basic percussion notation} を参照してください。
2287
2288 @strong{音型モード}
2289
2290 このモードは @code{\figuremode} コマンドで有効になり、@c
2291 入力は通奏低音の構文で解釈されるようになります。@c
2292 @ref{Entering figured bass} を参照してください。
2293
2294 また、音型モードは @code{\figures} コマンドでも有効になります。@c
2295 このモードも新たに @code{FiguredBass} コンテキストを作成し、@c
2296 コマンドの後に続く入力を通奏低音の構文で解釈して、@c
2297 @code{FiguredBass} コンテキストの中に通奏低音記号として描画します。@c
2298 @ref{Introduction to figured bass} を参照してください。
2299
2300 @strong{フレットとタブ モード}
2301
2302 フレット記号とタブ記号を入力するための特別な入力モードはありません。
2303
2304 タブ図を作成するには、音符モードで音符や和音を入力して、@c
2305 それらを @code{TabStaff} コンテキストの中に描画します。@c
2306 @ref{Default tablatures} を参照してください。
2307
2308 譜の上にフレット図を作成するには、2 つの方法があります。@c
2309 @code{FretBoards} コンテキスト
2310 (@ref{Automatic fret diagrams} を参照してください) を用いるか、@c
2311 あるいは、音符の上に @code{\fret-diagram} コマンド
2312 (@ref{Fret diagram markups}) を用いてフレット図をマークアップとして@c
2313 入力するかのどちらかになります。
2314
2315 @strong{歌詞モード}
2316
2317 このモードは @code{\lyricmode} コマンドで有効になり、@c
2318 入力はオプションで演奏時間を持つ歌詞音節として解釈され、@c
2319 歌詞識別子に関連付けされます。@c
2320 通奏低音の構文で解釈されるようになります。@c
2321 @ref{Vocal music} を参照してください。
2322
2323 また、歌詞モードは @code{\addlyrics} コマンドでも有効になります。@c
2324 このモードも新たに @code{Lyrics} コンテキストを作成し、@c
2325 暗黙的に @code{lyricsto} コマンドを作成します。@c
2326 @code{lyricsto} は、後に続く歌詞を、前にある音楽に関連付けします。
2327
2328 @strong{マークアップ モード}
2329
2330 このモードは @code{\markup} コマンドで有効になり、@c
2331 入力はマークアップの構文で解釈されるようになります。@c
2332 @ref{Text markup commands} を参照してください。
2333
2334 @c silly work-around for texinfo broken-ness
2335 @c (@strong{Note...} causes a spurious cross-reference in Info)
2336 @strong{音符モード}
2337
2338 このモードはデフォルトのモードであり、@c
2339 @code{\notemode} コマンドで有効にすることもできます。@c
2340 入力はピッチ、演奏時間、マークアップなどとして解釈され、@c
2341 譜面上に音楽記譜として写植されます。
2342
2343 通常、音符モードを明示的に指定する必要はありません。@c
2344 しかしながら、ある特定の状況
2345 -- 例えば、歌詞モード、和音モード、あるいは他のモードを使っていて、@c
2346 音符モードの構文でしか入力できないものを入力しようとしている場合 --
2347 では、音符モードを明示的に指定することが有用な場合があります。
2348
2349 例えば、合唱曲で節ごとに強弱記号を指定するには、@c
2350 音符モードで入力して記号を解釈させる必要があります:
2351
2352 @lilypond[verbatim,relative=2,quote]
2353 { c4 c4 c4 c4 }
2354 \addlyrics {
2355   \notemode{\set stanza = \markup{ \dynamic f 1. } }
2356   To be sung loudly
2357 }
2358 \addlyrics {
2359   \notemode{\set stanza = \markup{ \dynamic p 2. } }
2360   To be sung quietly
2361 }
2362 @end lilypond
2363
2364
2365 @node 向きと配置
2366 @subsection 向きと配置
2367 @translationof Direction and placement
2368
2369 楽譜を写植しているとき、多くの要素の向きと配置には選択の余地があります。@c
2370 例えば、音符の符幹は上向きあるいは下向きにすることができ、@c
2371 歌詞、強弱記号、他の表現記号は譜の上あるいは下に配置することができ、@c
2372 テキストは左揃え、右揃え、あるいは中央揃えにすることができる、などです。@c
2373 これらの選択のほとんどは LilyPond によって自動的に決定されますが、@c
2374 強制的に向きや配置を指定することが望ましい場合もあります。
2375
2376 @strong{アーティキュレーションの方向指示子}
2377
2378 デフォルトでは、アーティキュレーションのいくつかの向きは常に上または下に@c
2379 なっています (例えば、強弱記号やフェルマータ)。@c
2380 一方、他のアーティキュレーションは、符幹の向きによって、@c
2381 向きが上下します (スラーやアクセントなど)。
2382
2383 @c TODO Add table showing these
2384
2385 アーティキュレーションの前に @emph{方向指示子} を置くことで、@c
2386 デフォルトの向きをオーバライドすることができます。@c
2387 3 つの方向指示子があります: @code{^} (@qq{上向き} を意味します)、@c
2388 @code{_} (@qq{下向き} を意味します)、@c
2389 それに @code{-} (@qq{デフォルトの向き} を意味します) です。@c
2390 通常、方向指示子は省略することができ、その場合は @code{-} と見なされます。@c
2391 しかしながら、以下のものの前には @strong{常に} 方向指示子を置く必要があります:
2392
2393 @itemize
2394 @item @code{\tweak} コマンド
2395 @item @code{\markup} コマンド
2396 @item @code{\tag} コマンド
2397 @item 文字列マークアップ。例えば、-"string"
2398 @item 運指指示。例えば、@code{-1}
2399 @item アーティキュレーションの短縮記法。例えば、@code{-.}, @code{->}, @code{--}
2400 @end itemize
2401
2402 方向指示子は、その後にくる音符だけに効果を持ちます:
2403
2404 @lilypond[verbatim,quote,relative=2]
2405 c2( c)
2406 c2_( c)
2407 c2( c)
2408 c2^( c)
2409 @end lilypond
2410
2411 @strong{方向プロパティ}
2412
2413 多くのレイアウト オブジェクトの位置や向きは、@c
2414 @code{direction} プロパティによって制御されます。
2415
2416 @code{direction} プロパティの値は、@c
2417 @code{1} (@qq{上向き} あるいは @qq{上} を意味します)、@c
2418 @code{-1} (@qq{下向き} あるいは @qq{下} を意味します)
2419 にセットすることができます。@c
2420 記号 @code{UP} と @code{DOWN} は、@c
2421 それぞれ @code{1} と @code{-1} の代わりに用いることができます。@c
2422 デフォルトの向きを指定するには、@c
2423 @code{direction} を @code{0} あるいは @code{CENTER} にセットします。@c
2424 このような方法を用いる代わりに、@c
2425 多くの場合で、向きを指定するための前置コマンドが存在しています。@c
2426 それらはすべて以下のような形式をとります:
2427
2428 @noindent
2429 @code{\xxxUp}, @code{xxxDown}, @code{xxxNeutral}
2430
2431 @noindent
2432 ここで、@code{xxxNeutral} は @qq{デフォルトの向きを使用する}
2433 ことを意味します。@c
2434 @rlearning{譜内部オブジェクト} を参照してください。
2435
2436 いくつかのケースでは
2437 -- 一般的な例としてはアルペジオしかありません --
2438 @code{direction} プロパティの値は、@c
2439 オブジェクトが親オブジェクトの左右どちらに配置されるかを指定します。
2440 この場合、@code{-1} あるいは @code{LEFT} は @qq{左側} を意味し、@c
2441 @code{1} あるいは @code{RIGHT} は @qq{右側} を意味します。@c
2442 @code{0} あるいは @code{CENTER} は、前のケースと同様に、@c
2443 @qq{デフォルトの向きを使用する} ことを意味します。
2444
2445 @ignore
2446 These all have side-axis set to #X
2447 AmbitusAccidental - direction has no effect
2448 Arpeggio - works
2449 StanzaNumber - not tried
2450 TrillPitchAccidental - not tried
2451 TrillPitchGroup - not tried
2452 @end ignore
2453
2454 これらの指示子は、キャンセルされるまで効果を持ちます。
2455
2456 @lilypond[verbatim,quote,relative=2]
2457 c2( c)
2458 \slurDown
2459 c2( c)
2460 c2( c)
2461 \slurNeutral
2462 c2( c)
2463 @end lilypond
2464
2465
2466 @node コンテキスト レイアウトの順序
2467 @subsection コンテキスト レイアウトの順序
2468 @translationof Context layout order
2469
2470 @cindex contexts, layout order (コンテキスト レイアウトの順序)
2471
2472 通常、コンテキストは、入力ファイルの中で出現した順番に、@c
2473 システムの上から下へと配置されます。@c
2474 コンテキストがネストされている場合、@c
2475 入力ファイルの中で内側にネストされたコンテキストが@c
2476 外側のコンテキストの @q{accepts} リストの中に含まれているのなら、@c
2477 外側のコンテキストの内部に配置されます。@c
2478 外側のコンテキストの @qq{accepts} リストに含まれていない場合、@c
2479 外側のコンテキストの内部ではなく、下に再配置されます。
2480
2481 入力ファイルの中で、@c
2482 出現したコマンドを保持する適当なコンテキストが存在しない場合、@c
2483 コンテキストが暗黙的に作成されます。@c
2484 これは、予期しない譜やスコアを生み出す可能性があります。
2485
2486 コンテキストが配置される順序や @qq{accepts} リストは変更することができます。@c
2487 @ref{コンテキストを揃える} を参照してください。
2488
2489 @seealso
2490 アプリケーション使用方法:
2491 @rprogram{余計な譜が表示される}
2492
2493
2494 @node 距離と距離の単位
2495 @subsection 距離と距離の単位
2496 @translationof Distances and measurements
2497
2498 @cindex distances, absolute (絶対距離)
2499 @cindex distances, scaled (相対距離)
2500
2501 @funindex \mm
2502 @funindex \cm
2503 @funindex \in
2504 @funindex \pt
2505
2506 LilyPond における距離には 2 つのタイプがあります: 絶対距離と相対距離です。
2507
2508 絶対距離は、マージン、インデント、それにその他の詳細なページ レイアウトを@c
2509 指定するために使用され、デフォルトではミリメートルで指定されます。
2510 距離は以下の単位で指定することもできます: @code{\mm}, @code{\cm},
2511 @code{\inch} (インチ), それに @code{\pt} (ポイント。1/73.27 インチ) です。@c
2512 また、ページ レイアウトにおける距離は、@c
2513 値の後ろに @code{\staff-space} を付けることにより、
2514 比率で指定することもできます (次の段落を参照してください)。@c
2515 ページ レイアウトについての詳細は、@c
2516 @ref{ページ レイアウト} に記述されています。
2517
2518 相対距離は常に譜スペースを単位として指定されます
2519  -- 稀に、半譜スペースが使用されます。@c
2520 譜スペースは隣り合う 2 本の譜線間の距離です。@c
2521 グローバル譜サイズを設定することにより、@c
2522 デフォルト値をグローバルに変更することができます。@c
2523 また、@code{StaffSymbol} の @code{staff-space} プロパティを@c
2524 変更することにより、譜スペースをローカルにオーバライドすることもできます。@c
2525 相対距離は、グローバル譜サイズや @code{StaffSymbol} の @code{staff-space}
2526 プロパティのいずれかが変更されると、自動的に変更されます。@c
2527 しかしながら、フォントの比率はグローバル譜サイズが変更された場合にのみ、@c
2528 自動的に変更されます。@c
2529 そのため、グローバル譜サイズは@c
2530 容易に描画される楽譜全体のサイズを変更することができます。@c
2531 グローバル譜サイズを設定するための手段については、@c
2532 @ref{譜サイズを設定する} を参照してください。
2533
2534 @funindex magstep
2535
2536 楽譜のある部分だけの比率を変更したいのなら
2537 -- 例えば、オッシア セクションや脚注で --
2538 単純にグローバル譜サイズを変更するわけにはいきません。@c
2539 なぜなら、グローバル譜サイズを変更すると、楽譜全体が影響を受けるからです。@c
2540 そのような場合、@code{StaffSymbol} の @code{staff-space} プロパティと@c
2541 フォントのサイズをオーバライドすることにより、サイズを変更します。@c
2542 フォント サイズの変更を @code{staff-space} 単位の変更に変換するには、@c
2543 Scheme 関数 @code{magstep} を使用することができます。@c
2544 この関数の説明と使用例については、@c
2545 @rlearning{オブジェクトの長さと太さ} を参照してください。
2546
2547
2548 @seealso
2549 学習マニュアル:
2550 @rlearning{オブジェクトの長さと太さ}
2551
2552 記譜法リファレンス:
2553 @ref{ページ レイアウト},
2554 @ref{譜サイズを設定する}
2555
2556
2557 @node 譜記号プロパティ
2558 @subsection 譜記号プロパティ
2559 @translationof Staff symbol properties
2560
2561 @cindex adjusting staff symbol (譜記号を調節する)
2562 @cindex drawing staff symbol (譜記号を描画する)
2563 @cindex staff symbol, setting of (譜記号の設定)
2564
2565 @c TODO Extend or remove this section.  See also NR 1.6.2 Staff symbol
2566 @c      Need to think of uses for these properties.  Eg 'line-positions
2567 @c      is used in a snippet to thicken centre line.
2568 @c      If retained, add @ref to here in 1.6.2  -td
2569
2570 譜線の垂直位置と譜線の本数を同時に定義することができます。@c
2571 以下の例が示すように、音符の位置は譜線の位置には影響されません。
2572
2573 @warning{@code{'line-positions} プロパティは @code{'line-count} を@c
2574 オーバライドします。@c
2575 譜線の本数は、@code{'line-positions} の値リストの中にある要素数によって、@c
2576 暗黙的に定義されます。}
2577
2578 @lilypond[verbatim,quote,relative=1]
2579 \new Staff \with {
2580   \override StaffSymbol #'line-positions = #'(7 3 0 -4 -6 -7)
2581 }
2582 { a4 e' f b | d1 }
2583 @end lilypond
2584
2585 譜の幅を変更することができます。@c
2586 単位は譜スペースです。@c
2587 譜内部のオブジェクトのスペースは、この設定によって影響を受けません。
2588
2589 @lilypond[verbatim,quote,relative=1]
2590 \new Staff \with {
2591   \override StaffSymbol #'width = #23
2592 }
2593 { a4 e' f b | d1 }
2594 @end lilypond
2595
2596
2597 @node スパナ
2598 @subsection スパナ
2599 @translationof Spanners
2600
2601 多くの音楽記譜オブジェクトは、複数の音符あるいは複数の小節にまたがって、@c
2602 広がりを持ちます。@c
2603 例としては、スラー、連桁、連譜の囲み、volta 繰り返しの囲み、クレッシェンド、@c
2604 トリル、それにグリッサンドがあります。@c
2605 そのようなオブジェクトは総称して @qq{スパナ} と呼ばれ、@c
2606 それらの見た目と振る舞いを制御するための特殊なプロパティを持ちます。@c
2607 これらのプロパティのいくつかは、すべてのスパナに共通しています。@c
2608 他のプロパティはスパナの部分集合に限定されています。
2609
2610 すべてのスパナは @code{spanner-interface} をサポートします。@c
2611 いくつかのスパナ -- 2 つのオブジェクトの間に直線を描くもの -- は、さらに、@c
2612 @code{line-spanner-interface} をサポートします。
2613
2614
2615 @unnumberedsubsubsec @code{spanner-interface} を使用する
2616
2617 このインターフェイスは、@c
2618 いくつかのスパナに適用される 2 つのプロパティを提供します。
2619
2620 @strong{@i{@code{minimum-length} プロパティ}}
2621
2622 スパナの最短の長さは、@code{minimum-length} プロパティによって指定されます。@c
2623 通常、このプロパティを増加させると、@c
2624 スパナの両端の間にある音符の間隔は増加します。@c
2625 しかしながら、このオーバライドは多くのスパナで効果を持ちません。@c
2626 なぜなら、それらの長さは他の要素によって決定されるからです。@c
2627 以下に効果を持つ例を 2, 3 示します。
2628
2629 @ignore
2630 Works for:
2631   Tie
2632   MultiMeasureRest
2633   Hairpin
2634   Slur
2635   PhrasingSlur
2636
2637 Works as long as callback is made:
2638   Glissando
2639   Beam
2640
2641 Works not at all for:
2642   LyricSpace
2643   LyricHyphen
2644   LyricExtender
2645   TextSpanner
2646   System
2647
2648 @end ignore
2649
2650 @c KEEP LY
2651 @lilypond[verbatim,quote,relative=2]
2652 a~a
2653 a
2654 % タイの長さを増加させます
2655 -\tweak #'minimum-length #5
2656 ~a
2657 @end lilypond
2658
2659 @c KEEP LY
2660 @lilypond[verbatim,quote,relative=2]
2661 a1
2662 \compressFullBarRests
2663 R1*23
2664 % 休符バーの長さを増加させます
2665 \once \override MultiMeasureRest #'minimum-length = #20
2666 R1*23
2667 a1
2668 @end lilypond
2669
2670 @c KEEP LY
2671 @lilypond[verbatim,quote,relative=2]
2672 a \< a a a \!
2673 % ヘアピンの長さを増加させます
2674 \override Hairpin #'minimum-length = #20
2675 a \< a a a \!
2676 @end lilypond
2677
2678 さらに、このオーバライドはスラーとフレージング スラーの長さを@c
2679 増加させるためにも使用されます:
2680
2681 @lilypond[verbatim,quote,relative=2]
2682 a( a)
2683 a
2684 -\tweak #'minimum-length #5
2685 ( a)
2686
2687 a\( a\)
2688 a
2689 -\tweak #'minimum-length #5
2690 \( a\)
2691 @end lilypond
2692
2693 いくつかのレイアウト オブジェクトでは、@c
2694 @code{minimum-length} プロパティは、@c
2695 @code{set-spacing-rods} プロシージャが明示的に呼び出された場合にのみ@c
2696 効果を持ちます。@c
2697 このプロシージャを呼び出すには、@code{springs-and-rods} プロパティに@c
2698 @code{ly:spanner::set-spacing-rods} をセットしておく必要があります。@c
2699 例えば、グリッサンドの最短長は、@c
2700 @code{springs-and-rods} プロパティが設定されていない限り、@c
2701 効果を持ちません:
2702
2703 @c KEEP LY
2704 @lilypond[verbatim,quote,relative=1]
2705 % デフォルト
2706 e \glissando c'
2707
2708 % 単独では効果を持ちません
2709 \once \override Glissando #'minimum-length = #20
2710 e, \glissando c'
2711
2712 % 以下の両方のオーバライドが存在する場合にのみ、効果を持ちます
2713 \once \override Glissando #'minimum-length = #20
2714 \once \override Glissando #'springs-and-rods = #ly:spanner::set-spacing-rods
2715 e, \glissando c'
2716 @end lilypond
2717
2718 @code{Beam} オブジェクトでも同じことが言えます:
2719
2720 @c KEEP LY
2721 @lilypond[verbatim,quote,relative=1]
2722 % 単独では効果を持ちません
2723 \once \override Beam #'minimum-length = #20
2724 e8 e e e
2725
2726 % 以下の両方のオーバライドが存在する場合にのみ、効果を持ちます
2727 \once \override Beam #'minimum-length = #20
2728 \once \override Beam #'springs-and-rods = #ly:spanner::set-spacing-rods
2729 e8 e e e
2730 @end lilypond
2731
2732
2733 @strong{@i{@code{to-barline} プロパティ}}
2734
2735 @code{spanner-interface} の 2 番目に有用なプロパティは
2736 @code{to-barline} です。@c
2737 デフォルトではこのプロパティは真であり、@c
2738 小節の最初の音符のところで終了するヘアピンや他のスパナは@c
2739 直前の小節線のところで終了させられます。@c
2740 偽に設定すると、スパナは小節線を越えて、音符のところで終了します:
2741
2742 @lilypond[verbatim,quote,relative=2]
2743 a \< a a a a \! a a a \break
2744 \override Hairpin #'to-barline = ##f
2745 a \< a a a a \! a a a
2746 @end lilypond
2747
2748 このプロパティはすべてのスパナに対して効果を持つわけではありません。@c
2749 例えば、スラーやフレージング スラー、@c
2750 あるいは小節線で終了させることに意味が無い他のスパナに対して、@c
2751 このプロパティを @code{#t} に設定しても効果がありません。
2752
2753
2754 @unnumberedsubsubsec @code{line-spanner-interface} を使用する
2755
2756 @code{line-spanner-interface} をサポートするオブジェクトには@c
2757 以下のものがあります:
2758
2759 @itemize
2760 @item @code{DynamicTextSpanner}
2761 @item @code{Glissando}
2762 @item @code{TextSpanner}
2763 @item @code{TrillSpanner}
2764 @item @code{VoiceFollower}
2765 @end itemize
2766
2767 これらのスパナのステンシルを描画する責任を持つルーチンは
2768 @code{ly:line-interface::print} です。@c
2769 このルーチンはスパナの両端の位置を綿密に決定し、@c
2770 求めに応じたスタイルでそれらの間に線を描きます@c
2771 スパナの両端の位置はオンザフライ (その場、その時々) で算出されますが、@c
2772 それらの Y 座標をオーバライドすることができます。@c
2773 指定する必要のあるプロパティは、@c
2774 プロパティ階層内で 2 階層下にネストされていますが、@c
2775 この @code{\override} コマンドは非常にシンプルです:
2776
2777 @lilypond[relative=2,quote,verbatim]
2778 e2 \glissando b
2779 \once \override Glissando #'(bound-details left Y) = #3
2780 \once \override Glissando #'(bound-details right Y) = #-2
2781 e2 \glissando b
2782 @end lilypond
2783
2784 @code{Y} プロパティの単位は @code{staff-space} であり、@c
2785 譜の中央線が 0 位置です。@c
2786 グリッサンドでは、スパナの両端は各符頭の中心であり、@c
2787 @code{Y} はそれらの点を上下させます。
2788
2789 @code{Y} が設定されていない場合、@c
2790 値はスパナの両端の垂直位置から算出されます。
2791
2792 改行の場合、終点の @code{Y} の値は @code{bound-details} の@c
2793 部分リスト @code{left-broken} や @code{right-broken} のによって指定されます。@c
2794 例を示します:
2795
2796 @lilypond[relative=2,ragged-right,verbatim,fragment]
2797 \override Glissando #'breakable = ##t
2798 \override Glissando #'(bound-details right-broken Y) = #-3
2799 c1 \glissando \break
2800 f1
2801 @end lilypond
2802
2803
2804 @code{bound-details} プロパティの部分リスト @code{left} や @code{right} の@c
2805 下位プロパティのいくつかは、@code{Y} と同じ方法で変更することができます:
2806
2807 @table @code
2808 @item Y
2809 終点の Y 座標を、@c
2810 譜の中央線からの @code{staff-space} オフセットで、設定します。@c
2811 デフォルトでは、終点オブジェクトの中心です。@c
2812 ですから、グリッサンドは符頭の中心に向かって進みます。
2813
2814 水平方向に広がるスパナ -- テキスト スパナやトリル スパナなど --
2815 では、この値は 0 に固定されています。
2816
2817 @item attach-dir
2818 スパナのラインがオブジェクトの左右どちらから始まり、終わるのかを決定します。@c
2819 @code{-1} (あるいは @code{LEFT}) であれば、@c
2820 ラインは符頭の左側から開始あるいは終了します。
2821
2822 @item X
2823 終点の絶対 X 座標です。@c
2824 通常、オンザフライ (その場、その時々) で算出され、@c
2825 これをオーバライドしてもあまり意味がありません。
2826
2827 @item stencil
2828 ライン スパナは開始点や終了点で記号を持つ場合があり、@c
2829 その記号はこのサブ プロパティに保持されています。@c
2830 このサブ プロパティは内部で使用するためのものです。@c
2831 このサブ プロパティの代わりに @code{text} を使用することを推奨します。
2832
2833 @item text
2834 ステンシルを作成するために評価されるマークアップです。@c
2835 水平スパナに @i{cresc.}, @i{tr} それに他のテキストを配置するために使用されます。
2836
2837 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2838 \override TextSpanner #'(bound-details left text)
2839    = \markup { \small \bold Slower }
2840 c2\startTextSpan b c a\stopTextSpan
2841 @end lilypond
2842
2843 @item stencil-align-dir-y
2844 @item stencil-offset
2845 これらの 1 つを設定しなければ、@c
2846 ステンシルは、@code{X} と @code{Y} サブ プロパティで定義されたとおりに、@c
2847 ラインに中央揃えで、終点に配置されます。@c
2848 @code{stencil-align-dir-y} あるいは @code{stencil-offset} の@c
2849 どちらかを設定すると、@c
2850 記号が上下します:
2851
2852 @lilypond[relative=1,fragment,verbatim]
2853 \override TextSpanner
2854   #'(bound-details left stencil-align-dir-y) = #-2
2855 \override TextSpanner
2856   #'(bound-details right stencil-align-dir-y) = #UP
2857
2858 \override TextSpanner
2859   #'(bound-details left text) = #"ggg"
2860 \override TextSpanner
2861   #'(bound-details right text) = #"hhh"
2862 c4^\startTextSpan c c c \stopTextSpan
2863 @end lilypond
2864
2865 予期される結果とは逆に、@c
2866 負の値はテキストを @emph{上げる} ということに注意してください。@c
2867 なぜなら、@code{-1} あるいは @code{DOWN} は@c
2868 テキストの @emph{下端} をスパナ ラインに揃え、
2869 @code{1} あるいは @code{UP} は@c
2870 テキストの @emph{上端} をスパナ ラインに揃えるからです。
2871
2872 @item arrow
2873 このサブ プロパティに @code{#t} をセットするとラインの終点に矢印が描かれます。
2874
2875 @item padding
2876 このサブ プロパティはラインの終点と実際の終点の間のスペースを制御します。@c
2877 パディングがなければ、グリッサンドは両端の符頭の中心から描かれます。
2878
2879 @end table
2880
2881 音楽関数 @code{\endSpanners} は@c
2882 直後の音符から始まるスパナをすぐに終了させます。@c
2883 ちょうど 1 音符分でスパナを終了させますが、@c
2884 @code{to-barline} が真で、かつ、次の音符の前に小節線がある場合は@c
2885 その小節線のところでスパナを終了させます。
2886
2887 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
2888 \endSpanners
2889 c2 \startTextSpan c2 c2
2890 \endSpanners
2891 c2 \< c2 c2
2892 @end lilypond
2893
2894 @code{\endSpanners} を使用している場合、@c
2895 @code{\startTextSpan} を @code{\endTextSpan} で閉じる必要はなく、@c
2896 ヘアピンを @code{\!} で閉じる必要もありません。
2897
2898
2899 @seealso
2900 内部リファレンス:
2901 @rinternals{TextSpanner},
2902 @rinternals{Glissando},
2903 @rinternals{VoiceFollower},
2904 @rinternals{TrillSpanner},
2905 @rinternals{line-spanner-interface}
2906
2907
2908 @node オブジェクトの可視性
2909 @subsection オブジェクトの可視性
2910 @translationof Visibility of objects
2911
2912 @cindex objects, visibility of (オブジェクトの可視性)
2913 @cindex grobs, visibility of (グラフィカル オブジェクトの可視性)
2914 @cindex visibility of objects (オブジェクトの可視性)
2915
2916 レイアウト オブジェクトの可視性を制御する主な方法は 4 つあります:
2917 オブジェクトのステンシルを削除する方法、オブジェクトを透明にする方法、@c
2918 オブジェクトの色を白にする方法、あるいは、@c
2919 オブジェクトの @code{break-visibility} プロパティをオーバライドする方法です。
2920 最初の 3 つの方法はすべてのレイアウト オブジェクトに適用されますが、@c
2921 最後の方法はいくつかの -- @emph{改行可能な} オブジェクト --
2922 だけに適用されます。@c
2923 学習マニュアルでは、これら 4 つのテクニックについて紹介しています。@c
2924 @rlearning{オブジェクトの可視性と色} を参照してください。
2925
2926 さらに、特定のレイアウト オブジェクト特有のテクニックがいくつかあります。@c
2927 それらについては、特別な考慮でカバーされています。
2928
2929 @menu
2930 * ステンシルを削除する::
2931 * オブジェクトを透明にする::
2932 * オブジェクトを白で描く::
2933 * break-visibility を用いる::
2934 * 特別な考慮を必要とするもの::
2935 @end menu
2936
2937
2938 @node ステンシルを削除する
2939 @unnumberedsubsubsec ステンシルを削除する
2940 @translationof Removing the stencil
2941
2942 @cindex stencil, removing (ステンシルを削除する)
2943
2944 レウアウト オブジェクトはそれぞれステンシル プロパティを持ちます。@c
2945 デフォルトでは、@c
2946 このプロパティはそのオブジェクトを描画する特殊な関数にセットされています。@c
2947 このプロパティが @code{#f} にオーバライドされた場合、@c
2948 関数は呼び出されず、そのオブジェクトは描画されません。@c
2949 @code{\rever} でデフォルトの動作に戻すことができます。
2950
2951 @lilypond[quote,verbatim,relative=1]
2952 a1 a
2953 \override Score.BarLine #'stencil = ##f
2954 a a
2955 \revert Score.BarLine #'stencil
2956 a a a
2957 @end lilypond
2958
2959 @node オブジェクトを透明にする
2960 @unnumberedsubsubsec オブジェクトを透明にする
2961 @translationof Making objects transparent
2962
2963 @cindex transparent, making objects (オブジェクトを透明にする)
2964
2965 レイアウト オブジェクトはそれぞれ @code{transparent} プロパティを持っていて、@c
2966 デフォルトでは @code{#f} にセットされています。@c
2967 @code{#t} にセットされると、そのオブジェクトはスペースを占めたままですが、@c
2968 不可視になります。
2969
2970 @lilypond[quote,verbatim,relative=2]
2971 a4 a
2972 \once \override NoteHead #'transparent = ##t
2973 a a
2974 @end lilypond
2975
2976 @node オブジェクトを白で描く
2977 @unnumberedsubsubsec オブジェクトを白で描く
2978 @translationof Painting objects white
2979
2980 @cindex objects, coloring (オブジェクトに色を付ける)
2981 @cindex coloring objects (オブジェクトに色を付ける)
2982 @cindex layers (レイヤ)
2983 @cindex printing order (描画の順番)
2984 @cindex overwriting objects (オブジェクトを上書きする)
2985 @cindex objects, overwriting (オブジェクトを上書きする)
2986 @cindex grobs, overwriting (グラフィカル オブジェクトを上書きする)
2987
2988 レイアウト オブジェクトはそれぞれ @code{color} プロパティを持っていて、@c
2989 デフォルトでは @code{black} にセットされています。@c
2990 このプロパティが @code{white} にセットされてると、@c
2991 そのオブジェクトは白い背景と区別が付かなくなります。@c
2992 しかしながら、そのオブジェクトが他のオブジェクトと交差している場合、@c
2993 交差している場所の色はオブジェクトの描画順序によって決定されます。@c
2994 これにより、以下に示すように、@c
2995 白いオブジェクトの画像が幽霊のように浮かび上がることがあります:
2996
2997 @lilypond[quote,verbatim,relative=2]
2998 \override Staff.Clef #'color = #white
2999 a1
3000 @end lilypond
3001
3002 オブジェクトの描画順序を変更することにより、これを回避することができます。@c
3003 すべてのレイアウト オブジェクトは @code{layer} プロパティを持っており、@c
3004 このプロパティには整数がセットされています。@c
3005 より小さな値の @code{layer} を持つオブジェクトが最初に描画され、@c
3006 より大きな値の @code{layer} を持つオブジェクトが後になってから描画されます。@c
3007 このため、@c
3008 より大きな値を持つオブジェクトがより小さな値を持つオブジェクトを上書きします。@c
3009 デフォルトでは、@c
3010 たいていのオブジェクトの @code{layer} には @code{1} が代入されています。@c
3011 しかしながら、いくつかのオブジェクト
3012 -- @code{StaffSymbol} や @code{BarLine} など --
3013 には @code{0} が代入されています。@c
3014 同じ値の @code{layer} を持つオブジェクトを描画する順番は不確定です。
3015
3016 上記の例において、白い音部記号
3017 (この @code{layer} のデフォルト値は @code{1} です)
3018 は譜線 @c
3019 (この @code{layer} のデフォルト値は @code{0} です)
3020 の後に描画されます。@c
3021 そのため、音部記号は譜線を上書きしています。@c
3022 これを変更するには、@code{Clef} オブジェクトの @code{layer} に@c
3023 より小さな値 -- 例えば、@code{-1} -- を与えて、@c
3024 音部記号を先に描画させる必要があります:
3025
3026 @lilypond[quote,verbatim,relative=2]
3027 \override Staff.Clef #'color = #white
3028 \override Staff.Clef #'layer = #-1
3029 a1
3030 @end lilypond
3031
3032 @node break-visibility を用いる
3033 @unnumberedsubsubsec break-visibility を用いる
3034 @translationof Using break-visibility
3035
3036 @c TODO Add making other objects breakable
3037
3038 @cindex break-visibility
3039
3040 たいていのレイアウト オブジェクトは 1 回だけ描画されます。@c
3041 しかしながら、小節線、音部記号、拍子記号、それに調号などのオブジェクトは、@c
3042 改行が起こると 2 回描画する必要があります
3043 -- 行の最後で 1 回、次の行の最初でもう 1 回。@c
3044 そのようなオブジェクトは @emph{改行可能} と呼ばれ、@c
3045 それらのオブジェクトが描画される可能性がある 3 つの場所
3046 -- 行の先頭、行の途中 (それらが変更された場合)、@c
3047 それに、行の最後 (そこで変更が行われた場合) --
3048 における可視性を制御する @code{break-visibility} プロパティを持ちます。
3049
3050 例えば、デフォルトでは拍子記号は最初の行の先頭で描画されますが、@c
3051 変更されない限り他の場所には描画されません。@c
3052 変更された場合、拍子記号は変更が行われた場所に描画されます。@c
3053 この変更が行の最後で行われた場合、新しい拍子記号は次の行の先頭に描画され、@c
3054 その前の行の最後にも忠告の拍子記号が描画されます。
3055
3056 この振る舞いは @code{break-visibility} プロパティによって制御されます。@c
3057 このプロパティについての説明は
3058 @c Leave this ref on a newline - formats incorrectly otherwise -td
3059 @rlearning{オブジェクトの可視性と色}
3060 を参照してください。@c
3061 このプロパティは 3 つのブール値からなるベクトルをとり、@c
3062 順に、そのオブジェクトが行の最後で描画されるかどうか、@c
3063 行の途中で描画されるかどうか、@c
3064 そして、行の先頭で描画されるかどうかを決定します。@c
3065 より正確には、改行の前、改行がない場合、改行の後です。
3066
3067 @code{break-visibility} プロパティによって制御する代わりに、@c
3068 これら 8 通りの組み合わせを @file{scm/output-lib.scm} で定義されている@c
3069 定義済み関数によって指定することもできます。@c
3070 このファイルの中で、最後の 3 列がその列のヘッダで示される場所での@c
3071 可視性を表しています:
3072
3073 @multitable {@code{begin-of-line-invisible}} {@code{'#(#t #t #t)}} {yes} {yes} {yes}
3074 @headitem 関数                       @tab ベクトル                @tab 改行前 @tab 改行なし @tab 改行後
3075
3076 @item @code{all-visible}             @tab @code{'#(#t #t #t)}     @tab yes    @tab yes      @tab yes
3077 @item @code{begin-of-line-visible}   @tab @code{'#(#f #f #t)}     @tab no     @tab no       @tab yes
3078 @item @code{center-visible}          @tab @code{'#(#f #t #f)}     @tab no     @tab yes      @tab no
3079 @item @code{end-of-line-visible}     @tab @code{'#(#t #f #f)}     @tab yes    @tab no       @tab no
3080 @item @code{begin-of-line-invisible} @tab @code{'#(#t #t #f)}     @tab yes    @tab yes      @tab no
3081 @item @code{center-invisible}        @tab @code{'#(#t #f #t)}     @tab yes    @tab no       @tab yes
3082 @item @code{end-of-line-invisible}   @tab @code{'#(#f #t #t)}     @tab no     @tab yes      @tab yes
3083 @item @code{all-invisible}           @tab @code{'#(#f #f #f)}     @tab no     @tab no       @tab no
3084 @end multitable
3085
3086 @code{break-visibility} のデフォルト設定は@c
3087 レイアウト オブジェクトによって異なります。@c
3088 以下の表は、@code{break-visibility} によって影響をうける@c
3089 すべてのレイアウト オブジェクトと、そのプロパティのデフォルト設定を示しています:
3090
3091 @multitable @columnfractions .3 .3 .4
3092
3093 @headitem レイアウト オブジェクト   @tab 通常のコンテキスト  @tab デフォルト設定
3094
3095 @c omit Ambitus as it appears not to be affected by break-visibility -td
3096 @c @item @code{Ambitus}          @tab as specified   @tab @code{begin-of-line-visible}
3097 @item @code{BarLine}             @tab @code{Score}          @tab calculated
3098 @item @code{BarNumber}           @tab @code{Score}          @tab @code{begin-of-line-visible}
3099 @c omit the following item until it can be explained -td
3100 @c @item @code{BreakAlignGroup}  @tab @code{Score}          @tab calculated
3101 @item @code{BreathingSign}       @tab @code{Voice}          @tab @code{begin-of-line-invisible}
3102 @item @code{Clef}                @tab @code{Staff}          @tab @code{begin-of-line-visible}
3103 @item @code{Custos}              @tab @code{Staff}          @tab @code{end-of-line-visible}
3104 @item @code{DoublePercentRepeat} @tab @code{Voice}          @tab @code{begin-of-line-invisible}
3105 @c omit KeyCancellation until it can be explained -td
3106 @c @item @code{KeyCancellation}  @tab ??             @tab @code{begin-of-line-invisible}
3107 @item @code{KeySignature}        @tab @code{Staff}          @tab @code{begin-of-line-visible}
3108 @c omit LeftEdge until it can be explained -td
3109 @c @item @code{LeftEdge}         @tab @code{Score}          @tab @code{center-invisible}
3110 @item @code{OctavateEight}       @tab @code{Staff}          @tab @code{begin-of-line-visible}
3111 @item @code{RehearsalMark}       @tab @code{Score}          @tab @code{end-of-line-invisible}
3112 @item @code{TimeSignature}       @tab @code{Staff}          @tab @code{all-visible}
3113
3114 @end multitable
3115
3116 以下の例は、小節線の可視性を制御するベクトルの使用方法を示しています:
3117
3118 @c KEEP LY
3119 @lilypond[quote,verbatim,relative=1,ragged-right]
3120 f4 g a b
3121 f4 g a b
3122 % カレント行の最後で小節線を削除します
3123 \once \override Score.BarLine #'break-visibility = #'#(#f #t #t)
3124 \break
3125 f4 g a b
3126 f4 g a b
3127 @end lilypond
3128
3129 @code{break-visibility} をオーバライドするために使用される@c
3130 ベクトルの要素 3 つをすべて記述する必要がありますが、@c
3131 それらすべてが各レイアウト オブジェクトに対して効果を持つわけではなく、@c
3132 組み合わせによってはエラーになる場合もあります。@c
3133
3134 even give errors.  The following limitations apply:
3135
3136 @itemize @bullet
3137 @item 小節線を行の先頭に描画することはできません。
3138 @item 小節番号は 1 から始まるのでなければ、@c
3139 最初の行の先頭に描画することはできません。
3140 @item 音部記号 -- 以下を参照してください
3141 @item 2 重線のパーセント繰り返しはすべて描画するか、@c
3142 すべて描画しないかのどちらかです。@c
3143 描画するには @code{begin-of-line-invisible} を用い、@c
3144 描画しないのなら @code{all-invisible} を用います。
3145 @item Key signature -- 以下を参照してください
3146 @item OctavateEight -- 以下を参照してください
3147 @end itemize
3148
3149 @node 特別な考慮を必要とするもの
3150 @unnumberedsubsubsec 特別な考慮を必要とするもの
3151 @translationof Special considerations
3152
3153 @strong{@emph{明示的な変更の後の可視性}}
3154
3155 @cindex key signature, visibility following explicit change (明示的な変更の後の調号の可視性)
3156 @cindex explicitKeySignatureVisibility
3157 @cindex clef, visibility following explicit change (明示的な変更の後の音部記号の可視性)
3158 @cindex explicitClefVisibility
3159
3160 @code{break-visibility} プロパティが調号の可視性と音部記号の変更を@c
3161 制御するのは、行の先頭 -- つまり、改行の後 -- においてだけです。@c
3162 行の途中や終わりでの明示的な調の変更や音部記号の変更の後に出現する@c
3163 調合や音部記号の可視性には効果を持ちません。@c
3164 以下の例では、@code{all-invisible} がセットされていますが、@c
3165 B フラット メジャーへの明示的な変更の後に出現する調号は可視のままです。
3166
3167 @c KEEP LY
3168 @lilypond[quote,verbatim,relative=1,ragged-right]
3169 \key g \major
3170 f4 g a b
3171 % すべての調号を削除しようと試みます
3172 \override Staff.KeySignature #'break-visibility = #all-invisible
3173 \key bes \major
3174 f4 g a b
3175 \break
3176 f4 g a b
3177 f4 g a b
3178 @end lilypond
3179
3180 そのような明示的な調号や音部記号の変更の可視性は
3181 @code{explicitKeySignatureVisibility} プロパティや
3182 @code{explicitClefVisibility} プロパティによって制御されます。@c
3183 これらは @code{break-visibility} プロパティと等価であり、@c
3184 どちらも @code{break-visibility} と同様に 3 つのブール値からなるベクトルか@c
3185 上でリストアップした定義済み関数をとります。@c
3186 どちらも @code{Staff} コンテキストのプロパティであり、@c
3187 レイアウト オブジェクト自体のプロパティではありません。@c
3188 ですから、これらは @code{\set} コマンドでセットします。@c
3189 どちらもデフォルトでは @code{all-visible} がセットされています。@c
3190 これらのプロパティは明示的な変更の結果として生じる@c
3191 調号と音部記号の可視性だけを制御し、@c
3192 行の先頭での調号や音部記号には効果を持ちませんので、@c
3193 オブジェクトを削除するには適切な @code{break-visibility}
3194 をオーバライドする必要があります。
3195
3196 @lilypond[quote,verbatim,relative=1,ragged-right]
3197 \key g \major
3198 f4 g a b
3199 \set Staff.explicitKeySignatureVisibility = #all-invisible
3200 \override Staff.KeySignature #'break-visibility = #all-invisible
3201 \key bes \major
3202 f4 g a b \break
3203 f4 g a b
3204 f4 g a b
3205 @end lilypond
3206
3207 @strong{@emph{忠告の臨時記号の可視性}}
3208
3209 明示的な調の変更で描画される忠告の臨時記号を削除するには、@c
3210 @code{Staff} コンテキスト プロパティ @code{printKeyCancellation} に
3211 @code{#f} をセットします:
3212
3213 @lilypond[quote,verbatim,relative=1,ragged-right]
3214 \key g \major
3215 f4 g a b
3216 \set Staff.explicitKeySignatureVisibility = #all-invisible
3217 \set Staff.printKeyCancellation = ##f
3218 \override Staff.KeySignature #'break-visibility = #all-invisible
3219 \key bes \major
3220 f4 g a b \break
3221 f4 g a b
3222 f4 g a b
3223 @end lilypond
3224
3225 このオーバライドによって、調の変更を示す臨時記号だけが残ります。
3226
3227 @c TODO Add visibility of cautionary accidentals before notes
3228
3229 @strong{@emph{自動小節線}}
3230
3231 @cindex automaticBars
3232 @cindex bar lines, suppressing (小節線を消す)
3233
3234 特殊なケースとして、@c
3235 @code{Score} コンテキストの @code{automaticBars} プロパティを@c
3236 設定することにより、小節線の描画を Off にすることもできます。@c
3237 @code{#f} をセットされた場合、小節線は自動的には描画されなくなり、@c
3238 @code{\bar} コマンドで明示的に作成しなければならなくなります。@c
3239 定義済みコマンド @code{\cadenzaOn} とは異なり、小節数はカウントされ続けます。@c
3240 後になってこのプロパティに @code{#t} がセットされると、@c
3241 このカウントに従って小節線の生成が再開されます。@c
3242 @code{#f} がセットされている場合、@c
3243 改行が起こりえるのは明示的な @code{\bar} コマンドがある場所でだけになります。
3244
3245 @c TODO Add example
3246
3247 @strong{@emph{オクターブ移調付きの音部記号}}
3248
3249 @cindex octavated clefs, visibility of (オクターブ移調付きの音部記号の可視性)
3250 @cindex visibility of octavated clefs (オクターブ移調付きの音部記号の可視性)
3251 @cindex clefs, visibility of octavation (オクターブ移調付きの音部記号の可視性)
3252
3253 オクターブ移調付きの音部記号上の小さなオクターブ記号は
3254 @code{OctavateEight} レイアウト オブジェクトによって作り出されます。@c
3255 このオブジェクトの可視性は
3256 @code{Clef} オブジェクトの可視性とは独立して制御されます。@c
3257 そのため、各行の先頭においてそのような音部記号を完全に消そうとするなら、@c
3258 @code{Clef} オブジェクトと @code{OctavateEight} オブジェクトの両方に対して@c
3259 必要な @code{break-visibility} のオーバライドを行う必要があります。
3260
3261 明示的な音部記号の変更では、@c
3262 @code{explicitClefVisibility} プロパティが@c
3263 音部記号とそれに関連するオクターブ記号の両方を制御します。
3264
3265
3266 @seealso
3267 学習マニュアル:
3268 @rlearning{オブジェクトの可視性と色}
3269
3270
3271 @node ライン スタイル
3272 @subsection ライン スタイル
3273 @translationof Line styles
3274
3275 いくつかの演奏指示子
3276 -- 例えば、@i{rallentando}, @i{accelerando} それに @i{trills} など --
3277 はテキストとして記述され、@c
3278 線で (点線や波線の場合もあります) でいくつもの小節にわたって広がります。
3279
3280 これらはすべてグリッサンドと同じルーチンを用いてテキストと線を描きます。@c
3281 そのため、それらの振る舞いの調整も同じように行います。@c
3282 これらはスパナによって実現され、スパナを描くルーチンは
3283 @code{ly:line-interface::print} です。@c
3284 このルーチンは 2 つの @i{スパン ポイント} の位置を決定し、@c
3285 要求されたスタイルに応じてそれら 2 点の間に線を描きます。
3286
3287 利用可能なライン スタイルと、それらをどのように調整するかを示す例を挙げます。
3288
3289 @lilypond[relative=2,ragged-right,verbatim,fragment]
3290 d2 \glissando d'2
3291 \once \override Glissando #'style = #'dashed-line
3292 d,2 \glissando d'2
3293 \override Glissando #'style = #'dotted-line
3294 d,2 \glissando d'2
3295 \override Glissando #'style = #'zigzag
3296 d,2 \glissando d'2
3297 \override Glissando #'style = #'trill
3298 d,2 \glissando d'2
3299 @end lilypond
3300
3301 スパナの終点の位置は各グラフィック オブジェクトごとに@c
3302 オンザフライ (その場、その時々) で計算されますが、@c
3303 それらをオーバライドすることもできます:
3304
3305 @c TODO Complete
3306 @lilypond[relative=2,ragged-right,verbatim,quote]
3307 e2 \glissando f
3308 \once \override Glissando #'(bound-details right Y) = #-2
3309 e2 \glissando f
3310 @end lilypond
3311
3312 グリッサンドの終点の @code{Y} には @code{-2} がセットされています。@c
3313 @code{right} の代わりに @code{left} を指定することにより、@c
3314 始点も同じように調整することができます。
3315
3316 @code{Y} がセットされていない場合、@c
3317 その値はスパナが取り付けられるポイントの垂直位置から算出されます。
3318
3319 スパナに他の調整を行うことも可能です。@c
3320 詳細は @ref{スパナ} を参照してください。
3321
3322
3323 @node オブジェクトを回転させる
3324 @subsection オブジェクトを回転させる
3325 @translationof Rotating objects
3326
3327 レイアウト オブジェクトとマークアップ テキストの要素はどちらも@c
3328 任意のポイントを中心にして任意の角度で回転させることができます。@c
3329 しかしながら、回転させる方法はまったく異なります。
3330
3331 @menu
3332 * レイアウト オブジェクトを回転させる::
3333 * マークアップを回転させる::
3334 @end menu
3335
3336 @node レイアウト オブジェクトを回転させる
3337 @unnumberedsubsubsec レイアウト オブジェクトを回転させる
3338 @translationof Rotating layout objects
3339
3340 @cindex rotating objects (オブジェクトを回転させる)
3341 @cindex objects, rotating (オブジェクトを回転させる)
3342
3343 @code{grob-interface} をサポートするすべてのレイアウト オブジェクトは、@c
3344 それらのオブジェクトの @code{rotation} プロパティを設定することにより、@c
3345 回転させることができます。@c
3346 これは 3 要素のリストをとります: 反時計回りの回転の角度、@c
3347 オブジェクトの参照ポイントからの相対座標 x と y
3348 (この座標が回転の中心になります) です。@c
3349 回転の角度は @q{°}で指定し、座標は譜スペースで指定します。
3350
3351 回転の角度と回転の中心座標は、トライ&エラーで決定する必要があります。
3352
3353 @cindex hairpins, angled (回転させられたヘアピン)
3354 @cindex angled hairpins (回転させられたヘアピン)
3355
3356 レイアウト オブジェクトを回転させることが有用な状況はあまりありません。@c
3357 以下の例は、有用であるかもしれないシチュエーションの 1 つを示しています:
3358
3359 @lilypond[quote,verbatim,relative=1]
3360 g4\< e' d' f\!
3361 \override Hairpin #'rotation = #'(20 -1 0)
3362 g,,4\< e' d' f\!
3363 @end lilypond
3364
3365 @node マークアップを回転させる
3366 @unnumberedsubsubsec マークアップを回転させる
3367 @translationof Rotating markup
3368
3369 すべてのマークアップ テキストは、@code{\rotate} コマンドを前に置くことにより、@c
3370 任意の角度に回転させることができます。@c
3371 このコマンドは 2 つの引数をとります: 反時計回りの回転の角度 @q{°} と、@c
3372 回転させられるテキストです。@c
3373 テキストの領域は回転しません:
3374 テキストの領域は回転させられるテキストの四隅になります。@c
3375 以下の例では、自動衝突回避を不可にするために@c
3376 テキストの @code{outside-staff-priority} プロパティに @code{#f} を@c
3377 セットしています。@c
3378 そうしなければテキストのいくつかは高く押し上げられてしまいます。
3379
3380 @lilypond[quote,verbatim,relative=1]
3381 \override TextScript #'outside-staff-priority = ##f
3382 g4^\markup { \rotate #30 "a G" }
3383 b^\markup { \rotate #30 "a B" }
3384 des^\markup { \rotate #30 "a D-Flat" }
3385 fis^\markup { \rotate #30 "an F-Sharp" }
3386 @end lilypond
3387
3388
3389 @node 高度な調整
3390 @section 高度な調整
3391 @translationof Advanced tweaks
3392
3393 このセクションでは、@c
3394 楽譜の見た目を細かく調節するためのさまざまなアプローチについて議論します。
3395
3396 @menu
3397 * オブジェクトを揃える::
3398 * グラフィカル オブジェクトを垂直方向にグループ化する::
3399 * ステンシルを変更する::
3400 * 形状を変更する::
3401 @end menu
3402
3403
3404 @seealso
3405 学習マニュアル:
3406 @rlearning{出力を調整する},
3407 @rlearning{その他の情報源}
3408
3409 記譜法リファレンス:
3410 @ref{内部リファレンスの説明},
3411 @ref{プロパティを変更する}
3412
3413 インストール済みファイル:
3414 @file{scm/define-grobs.scm}
3415
3416 コード断片集:
3417 @rlsr{Tweaks and overrides}
3418
3419 拡張:
3420 @rextend{Interfaces for programmers}
3421
3422 内部リファレンス:
3423 @rinternals{All layout objects}
3424
3425
3426 @node オブジェクトを揃える
3427 @subsection オブジェクトを揃える
3428 @translationof Aligning objects
3429
3430 @code{self-alignment-interface} と/あるいは @code{side-position-interface} を@c
3431 サポートするグラフィカル オブジェクトは、@c
3432 さまざまな形式で配置済みのオブジェクトに揃えることができます。@c
3433 そのようなオブジェクトのリストは、@rinternals{self-alignment-interface} と
3434 @rinternals{side-position-interface} を参照してください。@c
3435
3436 すべてのグラフィカル オブジェクトは参照ポイント、水平方向の広がり、@c
3437 それに垂直方向の広がりを持ちます。@c
3438 水平方向の広がりは、@c
3439 参照ポイントから左端と右端までの距離を意味する数値のペアであり、@c
3440 左端は負値です。@c
3441 垂直方向の広がりは、@c
3442 参照ポイントから下端と上端までの距離を意味する数値のペアであり、@c
3443 下端は負値です。@c
3444
3445 あるオブジェクトの譜面上の位置は、@code{X-offset} プロパティと
3446 @code{Y-offset} プロパティの値によって与えられます。@c
3447 @code{X-offset} の値は、親オブジェクトの参照ポイントの X 座標からの@c
3448 距離を意味します。@c
3449 @code{Y-offset} の値は、譜の中央線からの距離を意味します。@c
3450 @code{X-offset} と @code{Y-offset} の値は直接設定されることもありますし、@c
3451 いくつかの形式で親オブジェクトと揃えるために@c
3452 プロシージャによって算出されることもあります。
3453
3454 @c positioning considerations: 配置のための考慮 -> 配置規則
3455 @warning{多くのオブジェクトは特殊な配置規則を持っています。@c
3456 そのため、そのオブジェクトが @code{self-alignment-interface} を@c
3457 サポートしていたとしても、@c
3458 @code{X-offset} あるいは @code{Y-offset} の設定は無視されたり、@c
3459 変更されることがあります。}
3460
3461 例えば、臨時記号は @code{Y-offset} を設定することにより@c
3462 垂直方向の位置を変更することができますが、@code{X-offset} は効果を持ちません。
3463
3464 リハーサル記号は、小節線、音部記号、拍子記号それに調号などの@c
3465 改行可能なオブジェクトに揃えることができます。@c
3466 リハーサル記号をそのようなオブジェクトに合わせて配置するために、@c
3467 @code{break-aligned-interface} の中に特別なプロパティがあります。
3468
3469 @seealso
3470 @ref{break-alignable-interface を使用する},
3471 @rextend{Callback functions}
3472
3473 @menu
3474 * X-offset と Y-offset を直接設定する::
3475 * side-position-interface を使用する::
3476 * self-alignment-interface を使用する::
3477 * break-alignable-interface を使用する::
3478 @end menu
3479
3480 @node X-offset と Y-offset を直接設定する
3481 @unnumberedsubsubsec @code{X-offset} と @code{Y-offset} を直接設定する
3482 @translationof Setting X-offset and Y-offset directly
3483
3484 多くのオブジェクトの @code{X-offset} プロパティと @code{Y-offset} プロパティに@c
3485 数値を与えることができます。@c
3486 以下の例は、3 つの音符を示していて、1 つはデフォルト配置の運指記号を持ち、@c
3487 他の 2 つの運指記号は @code{X-offset} と @code{Y-offset} が変更されています。
3488
3489 @lilypond[verbatim,quote,relative=2]
3490 a-3
3491 a
3492 -\tweak #'X-offset #0
3493 -\tweak #'Y-offset #0
3494 -3
3495 a
3496 -\tweak #'X-offset #-1
3497 -\tweak #'Y-offset #1
3498 -3
3499 @end lilypond
3500
3501 @c TODO write more
3502
3503 @node side-position-interface を使用する
3504 @unnumberedsubsubsec @code{side-position-interface} を使用する
3505 @translationof Using the @code{side-position-interface}
3506
3507 @code{side-position-interface} をサポートするオブジェクトは、@c
3508 その親オブジェクトの隣に配置することができ、@c
3509 それにより、@c
3510 それら 2 つのオブジェクトの指定された端をくっつけることができます。@c
3511 オブジェクトを親オブジェクトの上、下、右、あるいは左に配置することができます。@c
3512 親オブジェクトを指定することはできません:
3513 親オブジェクトは入力ストリームの中での要素の順序によって決定されます。@c
3514 たいていのオブジェクトの親オブジェクトは、@c
3515 そのオブジェクトに関連する符頭となります。
3516
3517 @code{side-axis} プロパティと @code{direction} プロパティの値は、@c
3518 以下のように、オブジェクトが配置される場所を決定します:
3519
3520 @c TODO add an example of each to the table
3521
3522 @multitable @columnfractions .3 .3 .3
3523 @headitem @code{side-axis}  @tab @code{direction}  @tab
3524 @headitem property          @tab property          @tab Placement
3525
3526 @item     @code{0}          @tab @code{-1}         @tab 左
3527 @item     @code{0}          @tab @code{1}          @tab 右
3528 @item     @code{1}          @tab @code{-1}         @tab 下
3529 @item     @code{1}          @tab @code{1}          @tab 上
3530
3531 @end multitable
3532
3533 @code{side-axis} が @code{0} である場合、@code{X-offset} には@c
3534 プロシージャ @code{ly:side-position-interface::x-aligned-side} を@c
3535 セットする必要があります。@c
3536 このプロシージャは、@code{direction} の値に基づいて@c
3537 親オブジェクトの左あるいは右にオブジェクトを配置するための適切な値を
3538 @code{X-offset} に返します。
3539
3540 @code{side-axis} が @code{1} である場合、@code{Y-offset} には@c
3541 プロシージャ @code{ly:side-position-interface::y-aligned-side} を@c
3542 セットする必要があります。@c
3543 このプロシージャは、@code{direction} の値に基づいて@c
3544 親オブジェクトの上あるいは下にオブジェクトを配置するための適切な値を
3545 @code{Y-offset} に返します。
3546
3547 @c TODO Add examples
3548
3549 @node self-alignment-interface を使用する
3550 @unnumberedsubsubsec @code{self-alignment-interface} を使用する
3551 @translationof Using the @code{self-alignment-interface}
3552
3553 @emph{オブジェクトを自動的に水平方向に揃える}
3554
3555 @code{self-alignment-interface} をサポートするオブジェクトの水平方向の揃えは、@c
3556 @code{self-alignment-X} プロパティの値によって制御され、@c
3557 そのオブジェクトの @code{X-offset} プロパティには@c
3558 任意の実数値を与えることができる
3559 @code{ly:self-alignment-interface::x-aligned-on-self}.
3560 @code{self-alignment-X} がセットされます。@c
3561 与える実数値は、そのオブジェクトの X 方向の広がりの半分を単位とします。@c
3562 負値はオブジェクトを右に移動させ、正値はオブジェクトを左に移動させます。@c
3563 値が @code{0} であればそのオブジェクトは親オブジェクトの参照ポイントに@c
3564 中央揃えされ、@c
3565 値が @code{-1} であればそのオブジェクトの左端が親オブジェクトの参照ポイントに@c
3566 揃えられ、@c
3567 値が @code{1} であればそのオブジェクトの右端が親オブジェクトの参照ポイントに@c
3568 揃えられます。@c
3569 記号 @code{LEFT}, @code{CENTER}, それに @code{RIGHT} は@c
3570 それぞれ @w{@code{-1}, @code{0}, それに @code{1}} に対応します。
3571
3572 通常、@code{\override} コマンドを用いて @code{self-alignment-X} の値を@c
3573 変更しますが、@c
3574 @code{\tweak} コマンドを用いることで@c
3575 単一の音符に付けられている複数の注釈を個別に揃えることができます:
3576
3577 @lilypond[quote,verbatim,relative=1]
3578 a'
3579 -\tweak #'self-alignment-X #-1
3580 ^"left-aligned"
3581 -\tweak #'self-alignment-X #0
3582 ^"center-aligned"
3583 -\tweak #'self-alignment-X #RIGHT
3584 ^"right-aligned"
3585 -\tweak #'self-alignment-X #-2.5
3586 ^"aligned further to the right"
3587 @end lilypond
3588
3589 @emph{オブジェクトを自動的に垂直方向に揃える}
3590
3591 オブジェクトの @code{Y-offset} プロパティに
3592 @code{ly:self-alignment-interface::y-aligned-on-self} がセットされていれば、@c
3593 水平方向の揃えと同じように、垂直方向に揃えることができます。@c
3594 しかしながら、垂直方向の揃えには他のメカニズムも関与します:
3595 @code{Y-offset} の値は、垂直方向の揃えに関与する変数の 1 つに過ぎません。@c
3596 このことにより、いくつかのオブジェクトの @code{Y-offset} 値の調整は@c
3597 ややこしくなります。@c
3598 単位はそのオブジェクトの垂直方向の広がりの半分です。@c
3599 通常これは非常に小さいため、非常に大きな数値が必要になる可能性があります。@c
3600 値が @code{-1} であればそのオブジェクトの下端が親オブジェクトの参照ポイントに@c
3601 揃えられ、@c
3602 値が @code{0} であればそのオブジェクトの中央が親オブジェクトの参照ポイントに@c
3603 揃えられ、@c
3604 値が @code{1} であればそのオブジェクトの上端が親オブジェクトの参照ポイントに@c
3605 揃えられます。@c
3606 記号 @code{DOWN}, @code{CENTER}, それに @code{UP} は@c
3607 それぞれ @w{@code{-1}, @code{0}, それに @code{1}} に対応します。
3608
3609 @emph{オブジェクトを自動的に両方向に揃える}
3610
3611 @code{X-offset} と @code{Y-offset} の両方の設定を行うことで、@c
3612 オブジェクトの水平方向と垂直方向の揃えを同時に行うことができます。
3613
3614 以下の例は、運指記号を符頭に近づけるための調整方法を示しています。
3615
3616 @c KEEP LY
3617 @lilypond[quote,verbatim,relative=2]
3618 a
3619 -\tweak #'self-alignment-X #0.5  % 左方向に移動させます
3620 -\tweak #'Y-offset #ly:self-alignment-interface::y-aligned-on-self
3621 -\tweak #'self-alignment-Y #-1  % 上方向に移動させます
3622 -3  % 3 の指
3623 @end lilypond
3624
3625 @ignore
3626 @unnumberedsubsubsec Using the @code{aligned-on-parent} procedures
3627
3628 @c Cannot document as they do not seem to operate consistently on all objects -td
3629 @c TODO investigate further
3630
3631 The @code{aligned-on-parent} procedures are used in the same way
3632 as the @code{aligned-on-self} procedures, they difference being
3633 that they permit an object to be aligned with the @emph{edges} of
3634 the parent rather than the parent's reference point.  The following
3635 example shows the difference:
3636
3637 @c TODO Add example
3638
3639 @lilypond[verbatim,quote]
3640 @end lilypond
3641
3642 @end ignore
3643
3644 @ignore
3645 @unnumberedsubsubsec Using the @code{centered-on-parent} procedures
3646
3647 @c Cannot document as they do not seem to operate consistently on all objects -td
3648 @c TODO investigate further
3649
3650 @end ignore
3651
3652 @c TODO The align-interface, BassFigureAlignment and VerticalAlignment
3653
3654 @node break-alignable-interface を使用する
3655 @unnumberedsubsubsec @code{break-alignable-interface} を使用する
3656 @translationof Using the @code{break-alignable-interface}
3657
3658 @cindex align to objects (オブジェクトに揃える)
3659 @cindex break-align-symbols
3660
3661 リハーサル記号と小節番号を小節線ではなく、@c
3662 記譜オブジェクトに揃えることができます。@c
3663 対象となる記譜オブジェクトには、@code{ambitus},
3664 @code{breathing-sign}, @code{clef}, @code{custos}, @code{staff-bar},
3665 @code{left-edge}, @code{key-cancellation}, @code{key-signature}, それに
3666 @code{time-signature} があります。
3667
3668 デフォルトでは、@c
3669 リハーサル記号と小節番号はオブジェクトの上で水平方向に中央揃えされます:
3670
3671 @c KEEP LY
3672 @lilypond[verbatim,quote,relative=1]
3673 % リハーサル記号は音部記号の上に中央揃えされます
3674 \override Score.RehearsalMark #'break-align-symbols = #'(clef)
3675 \key a \major
3676 \clef treble
3677 \mark "↓"
3678 e1
3679 % リハーサル記号は拍子記号の上に中央揃えされます
3680 \override Score.RehearsalMark #'break-align-symbols = #'(time-signature)
3681 \key a \major
3682 \clef treble
3683 \time 3/4
3684 \mark "↓"
3685 e2.
3686 % リハーサル記号はブレス記号の上に中央揃えされます
3687 \override Score.RehearsalMark #'break-align-symbols = #'(breathing-sign)
3688 \key a \major
3689 \clef treble
3690 \time 4/4
3691 e1
3692 \breathe
3693 \mark "↓"
3694 @end lilypond
3695
3696 揃えの対象となり得るオブジェクトのリストを指定することができます。@c
3697 揃えを行う時点で対象リストの中にあるオブジェクトのいくつかが不可視である
3698 -- @code{break-visibility} の設定や、@c
3699 調号と音部に対する明示的な可視性の設定により --
3700 場合、リハーサル記号あるいは小節番号はリストの中にある@c
3701 最初の可視のオブジェクトに揃えられます。@c
3702 リストの中にあるオブジェクトがすべて不可視である場合、小節線に揃えられます。@c
3703 小節線が不可視である場合、小節線があるはずの場所に揃えられます。
3704
3705 @c KEEP LY
3706 @lilypond[verbatim,quote,relative=1]
3707 % リハーサル記号は調号の上に中央揃えされます
3708 \override Score.RehearsalMark #'break-align-symbols = #'(key-signature clef)
3709 \key a \major
3710 \clef treble
3711 \mark "↓"
3712 e1
3713 % リハーサル記号は音部記号の上に中央揃えされます
3714 \set Staff.explicitKeySignatureVisibility = #all-invisible
3715 \override Score.RehearsalMark #'break-align-symbols = #'(key-signature clef)
3716 \key a \minor
3717 \clef bass
3718 \mark "↓"
3719 gis,,1
3720 % リハーサル記号は小節線の上に中央揃えされます
3721 \set Staff.explicitKeySignatureVisibility = #all-invisible
3722 \set Staff.explicitClefVisibility = #all-invisible
3723 \override Score.RehearsalMark #'break-align-symbols = #'(key-signature clef)
3724 \key a \major
3725 \clef treble
3726 \mark "↓"
3727 e''1
3728 @end lilypond
3729
3730 以下の例で示すように、@c
3731 記譜オブジェクトに対するリハーサル記号の揃えを変更することができます。@c
3732 複数の譜を持つ楽譜では、この設定はすべての譜に適用されます。
3733
3734 @c KEEP LY
3735 @lilypond[verbatim,quote,relative=1]
3736 % RehearsalMark は KeySignature の上に中央揃えされます
3737 \override Score.RehearsalMark #'break-align-symbols = #'(key-signature)
3738 \key a \major
3739 \clef treble
3740 \time 4/4
3741 \mark "↓"
3742 e1
3743 % RehearsalMark は KeySignature の左端に揃えられます
3744 \once \override Score.KeySignature #'break-align-anchor-alignment = #LEFT
3745 \mark "↓"
3746 \key a \major
3747 e
3748 % RehearsalMark は KeySignature の右端に揃えられます
3749 \once \override Score.KeySignature #'break-align-anchor-alignment = #RIGHT
3750 \key a \major
3751 \mark "↓"
3752 e
3753 @end lilypond
3754
3755 また、リハーサル記号を左端に揃えて、@c
3756 さらに任意の量だけ右あるいは左にずらすことができます。@c
3757 単位は譜スペースです:
3758
3759 @c KEEP LY
3760 @lilypond[verbatim,quote,relative=1]
3761 % リハーサル記号は調号の左端に揃えられて
3762 % さらに 3.5 譜スペース右にずらされます
3763 \override Score.RehearsalMark #'break-align-symbols = #'(key-signature)
3764 \once \override Score.KeySignature #'break-align-anchor = #3.5
3765 \key a \major
3766 \mark "↓"
3767 e1
3768 % リハーサル記号は調号の左端に揃えられて
3769 % さらに 2 譜スペース左にずらされます
3770 \once \override Score.KeySignature #'break-align-anchor = #-2
3771 \key a \major
3772 \mark "↓"
3773 e1
3774 @end lilypond
3775
3776
3777 @node グラフィカル オブジェクトを垂直方向にグループ化する
3778 @subsection グラフィカル オブジェクトを垂直方向にグループ化する
3779 @translationof Vertical grouping of grobs
3780
3781 @c FIXME Expand this section
3782
3783 VerticalAlignment グラフィカル オブジェクトと
3784 VerticalAxisGroup グラフィカル オブジェクトは対で機能します。@c
3785 VerticalAxisGroup は Staff, Lyrics, 等のような@c
3786 異なるグラフィカル オブジェクトをグループにまとめます。@c
3787 それから、VerticalAlignment が
3788 VerticalAxisGroup によってグループ化されたグラフィカル オブジェクトを@c
3789 垂直方向に揃えます。@c
3790 通常、楽譜には VerticalAlignment は 1 つしかありませんが、@c
3791 Staff, Lyrics 等はそれ自体でそれぞれに VerticalAxisGroup を持ちます。
3792
3793
3794 @node ステンシルを変更する
3795 @subsection ステンシルを変更する
3796 @translationof Modifying stencils
3797
3798 すべてのレイアウト オブジェクトは、@c
3799 @code{grob-interface} の一部である @code{stencil} プロパティを持ちます。@c
3800 通常、デフォルトでこのプロパティには、@c
3801 出力でそのオブジェクトを具現化する記号を描画するための@c
3802 特有の関数がセットされています。@c
3803 例えば、@code{MultiMeasureRest} オブジェクトの @code{stencil} プロパティに@c
3804 対する標準設定は、@code{ly:multi-measure-rest::print} です。
3805
3806 @code{stencil} プロパティを変更して異なる描画関数を参照させることにより、@c
3807 オブジェクトの標準記号を置き換えることができます。@c
3808 これには LilyPond 内部機能についての高い知識が求められます。@c
3809 しかしながら、多くの場合にまずまずの結果を生み出すもっと簡単な方法があります。
3810
3811 簡単な方法では、@code{stencil} プロパティにテキストを描画する関数
3812 -- @code{ly:text-interface::print} -- をセットし、@c
3813 必要な記号を生み出すマークアップ テキストを保持するよう設定された
3814  @code{text} プロパティ与えます。@c
3815 マークアップの自由度の高さにより、多くのことを達成できます。@c
3816 詳細は、@ref{マークアップ内部でのグラフィック記譜法} を参照してください。
3817
3818 以下の例では、この方法を用いて符頭記号を内部に×を持つ円に変更しています。
3819
3820 @lilypond[verbatim,quote]
3821 XinO = {
3822   \once \override NoteHead  #'stencil = #ly:text-interface::print
3823   \once \override NoteHead #'text = \markup {
3824     \combine
3825       \halign #-0.7 \draw-circle #0.85 #0.2 ##f
3826       \musicglyph #"noteheads.s2cross"
3827   }
3828 }
3829 \relative c'' {
3830   a a \XinO a a
3831 }
3832 @end lilypond
3833
3834 @code{\musicglyph} マークアップ コマンドには、@c
3835 Feta フォントに含まれる任意の図柄を提供することができます。@c
3836 @ref{The Feta font} を参照してください。
3837
3838 @c TODO Add inserting eps files or ref to later
3839
3840 @c TODO Add inserting Postscript or ref to later
3841
3842
3843 @seealso
3844 記譜法リファレンス:
3845 @ref{マークアップ内部でのグラフィック記譜法},
3846 @ref{テキストをフォーマットする},
3847 @ref{Text markup commands},
3848 @ref{The Feta font}
3849
3850
3851 @node 形状を変更する
3852 @subsection 形状を変更する
3853 @translationof Modifying shapes
3854
3855 @menu
3856 * タイとスラーの形状を変更する::
3857 @end menu
3858
3859 @node タイとスラーの形状を変更する
3860 @unnumberedsubsubsec タイとスラーの形状を変更する
3861 @translationof Modifying ties and slurs
3862
3863 @cindex slurs, modifying (スラーの形状を変更する)
3864 @cindex ties, modifying (タイの形状を変更する)
3865 @cindex Bézier curves (ベジエ曲線)
3866 @cindex Bézier control points (ベジエ曲線の制御ポイント)
3867
3868 タイ、スラー、それにフレージング スラーは 3 次のベジエ曲線として描かれます。@c
3869 自動的に算出されるタイあるいはスラーの形状が最適ではない場合、@c
3870 3 次ベジエ曲線を定義するのに必要な 4 つの制御ポイントを@c
3871 明示的に指定することによって、形状を変更することができます。
3872
3873 3 次あるいは 3 乗のベジエ曲線は、4 つの制御ポイントによって定義されます。@c
3874 1 番目と 4 番目の制御ポイントは曲線の始点と終点になります。@c
3875 間にある 2 つの制御ポイントは曲線の形状を定義します。@c
3876 Web でベジエ曲線が描かれる様子を示すアニメーションを@c
3877 見つけることができるでしょう。@c
3878 しかしながら、以下の記述も役に立つかもしれません。@c
3879 ベジエ曲線は最初の制御ポイントから 2 番目の制御ポイントに進み、@c
3880 徐々に 3 番目の制御ポイントの方へ向きを変えながら
3881 4 番目の制御ポイントの方へ向かい続け、@c
3882 3 番目の制御ポイントから 4 番目の制御ポイントに到達します。@c
3883 ベジエ曲線は 4 つの制御ポイントからなる四角形の中に納まります。
3884
3885 ここで、@c
3886 タイが最適化されず、@code{\tieDown} が役に立たないケースを例として挙げます。
3887
3888 @lilypond[verbatim,quote,relative=1]
3889 <<
3890   { e1 ~ e }
3891 \\
3892   { r4 <g c,> <g c,> <g c,> }
3893 >>
3894 @end lilypond
3895
3896 以下のようにタイの制御ポイントを手動で変更することにより、@c
3897 このタイの形状を改善することができます。
3898
3899 ベジエ制御ポイントの座標は譜スペースを単位として指定されます。@c
3900 X@tie{}座標はそのタイあるいはスラーを取り付けられる音符の参照ポイントからの@c
3901 相対座標であり、Y@tie{}座標は譜の中央線からの相対座標です。@c
3902 制御ポイント座標は 10 進数 (実数) のペアを 4 つ持つリストとして設定されます。@c
3903 最適な制御ポイントを決定するための手順は、
3904 2 つの終点の座標を見積もり、それから 2 つの中間ポイントを推測することで、@c
3905 制御ポイントの座標を決定します。@c
3906 最適値はトライ&エラーで見つけ出します。
3907
3908 左右対称の曲線にするには制御ポイントを左右対称に配置する必要があるということを@c
3909 覚えておくと役に立ちます。@c
3910 また、ベジエ曲線の制御ポイントに平行移動、回転、それに拡大縮小などの変換を@c
3911 適用することにより、@c
3912 その曲線を変換できるという特性があるとも覚えておいてください。
3913
3914 上記の実例として、以下の例のオーバライドで満足のいくタイが得られています。@c
3915 オーバライドを配置する場所
3916 -- タイ (あるいはスラー) が開始する音符の直前に配置する必要があります --
3917 に注意してください。
3918
3919 @lilypond[verbatim,quote,relative=1]
3920 <<
3921   {
3922     \once \override Tie
3923       #'control-points = #'((1 . -1) (3 . 0.6) (12.5 . 0.6) (14.5 . -1))
3924      e1 ~ e
3925   }
3926 \\
3927   { r4 <g c,> <g c,> <g c,> }
3928 >>
3929 @end lilypond
3930
3931 @knownissues
3932
3933 同じ音楽タイミングに複数のタイあるいはスラーが存在する場合、@c
3934 @code{control-points} プロパティを変更しても@c
3935 それらの形状を変更することはできません。@c
3936 @code{\tweak} コマンドを用いたとしても変更できません。@c
3937 しかしながら、@code{TieColumn} の @code{tie-configuration} プロパティを@c
3938 オーバライドすることで、タイの垂直方向の位置と領域を変更することができます。
3939
3940 @seealso
3941 内部リファレンス:
3942 @rinternals{TieColumn}
3943
3944
3945 @node 音楽関数を使用する
3946 @section 音楽関数を使用する
3947 @translationof Using music functions
3948
3949 @c TODO -- add @seealso, etc. to these subsections
3950
3951 調整を異なる音楽表記に再利用する必要がある場合、@c
3952 その調整を音楽関数にしておくと便利です。@c
3953 このセクションでは、@emph{置換} 関数についてだけ議論します。@c
3954 置換関数は変数を LilyPond 入力コードに置き換えます。@c
3955 他のもっと複雑な関数については、@rextend{Music functions} で記述されています。
3956
3957 @menu
3958 * 置換関数の構文::
3959 * 置換関数の例::
3960 @end menu
3961
3962 @node 置換関数の構文
3963 @subsection 置換関数の構文
3964 @translationof Substitution function syntax
3965
3966 変数を LilyPond コードに置換する関数を作成することは簡単にできます。@c
3967 置換関数の一般的な形式は以下のようなものです:
3968
3969 @example
3970 function =
3971 #(define-music-function
3972      (parser location @var{arg1} @var{arg2} @dots{})
3973      (@var{type1?} @var{type2?} @dots{})
3974    #@{
3975      @var{@dots{}music@dots{}}
3976    #@})
3977 @end example
3978
3979 @noindent
3980 ここで
3981
3982 @multitable @columnfractions .33 .66
3983 @item @code{@var{argN}}
3984 @tab @var{n} 番目の引数
3985
3986 @item @code{@var{typeN?}}
3987 @tab @code{@var{argN}} が @code{#t} を返す Scheme の @emph{型述語} (type predicate)。
3988
3989 @item @code{@var{@dots{}music@dots{}}}
3990 @tab 通常の LilyPond 入力。@code{$} を用いて引数を参照します
3991 (例: @samp{$arg1})。
3992 @end multitable
3993
3994 です。
3995
3996 @ignore
3997 共通の変数タイプについては @ref{共通の引数タイプ} で記述されています。@c
3998 変数タイプについてのもっと完全な記述は
3999 @rextend{Music function syntax} にあります。
4000 @end ignore
4001
4002 引数 @code{parser} と @code{location} を省略することはできず、@c
4003 @rextend{Music function syntax} で記述されている高度な状況で@c
4004 使用されることがあります。
4005 置換関数において、必ずこれらの引数を記述してください。
4006
4007 引数として、型述語のリストも必須です。@c
4008 音楽関数で用いられる一般的な型述語には下記のものがあります:
4009
4010 @example
4011 boolean?
4012 cheap-list?  @emph{(}@q{list?}@emph{ の代わりに用いることで、処理を高速にします)}
4013 ly:music?
4014 markup?
4015 number?
4016 pair?
4017 string?
4018 symbol?
4019 @end example
4020
4021 @noindent
4022 利用可能な型述語のリストは、@c
4023 @ref{Predefined type predicates} を参照してください。@c
4024 ユーザが型述語を定義することもできます。
4025
4026
4027 @seealso
4028
4029 記譜法リファレンス:
4030 @ref{Predefined type predicates}
4031
4032 拡張:
4033 @rextend{Music function syntax}
4034
4035 インストールされているファイル:
4036 @file{lily/music-scheme.cc},
4037 @file{scm/c++.scm},
4038 @file{scm/lily.scm}
4039
4040
4041 @ignore
4042 @node 共通の引数タイプ
4043 @subsection 共通の引数タイプ
4044 @translationof Common argument types
4045
4046 エラー チェックを考慮して、@c
4047 音楽関数に渡される各引数タイプを定義しておく必要があります。@c
4048 共通の引数タイプのいくつかを以下の表で示します。@c
4049
4050 以下の入力タイプを音楽関数で変数として使用することができます。@c
4051 このリストは完全なものではありません。@c
4052 取り得る変数タイプについての更なる情報は、
4053 @rextend{Music function syntax} にあります。
4054
4055 @multitable @columnfractions .33 .66
4056 @headitem 入力タイプ          @tab @var{vari-type?} での記述方法
4057 @item 整数                    @tab @code{integer?}
4058 @item 浮動小数点数 (10 進数)  @tab @code{number?}
4059 @item テキスト文字列          @tab @code{string?}
4060 @item マークアップ            @tab @code{markup?}
4061 @item 音楽表記                @tab @code{ly:music?}
4062 @item Scheme ペア             @tab @code{pair?}
4063 @end multitable
4064
4065 @seealso
4066
4067 LilyPond の拡張:
4068 @rextend {Music function syntax}
4069
4070 インストール済みファイル:
4071 @file{lily/music-scheme.cc},
4072 @file{scm/c++.scm}
4073 @end ignore
4074
4075
4076 @c ここから L3796
4077 @node 置換関数の例
4078 @subsection 置換関数の例
4079 @translationof Substitution function examples
4080
4081 このセクションでは、置換関数の例をいくつか紹介します。@c
4082 高度なことはしていませんが、シンプルな置換関数を実現する方法を示しています。
4083
4084 最初の例では、@c
4085 @code{TextScript} のパディング設定を容易にするための関数が定義されています:
4086
4087 @lilypond[quote,verbatim,ragged-right]
4088 padText =
4089 #(define-music-function
4090      (parser location padding)
4091      (number?)
4092    #{
4093      \once \override TextScript #'padding = $padding
4094    #})
4095
4096 \relative c''' {
4097   c4^"piu mosso" b a b
4098   \padText #1.8
4099   c4^"piu mosso" d e f
4100   \padText #2.6
4101   c4^"piu mosso" fis a g
4102 }
4103 @end lilypond
4104
4105 数値のほかに、音符などの音楽表記を音楽関数への引数にすることができます:
4106
4107 @c TODO: use a better example (the music argument is redundant).
4108
4109 @lilypond[quote,verbatim,ragged-right]
4110 custosNote =
4111 #(define-music-function
4112      (parser location note)
4113      (ly:music?)
4114    #{
4115      \once \override Voice.NoteHead #'stencil =
4116        #ly:text-interface::print
4117      \once \override Voice.NoteHead #'text =
4118        \markup \musicglyph #"custodes.mensural.u0"
4119      \once \override Voice.Stem #'stencil = ##f
4120      $note
4121    #})
4122
4123 \relative c' { c4 d e f \custosNote g }
4124 @end lilypond
4125
4126 複数の引数をとる置換関数を定義することもできます:
4127
4128 @lilypond[quote,verbatim,ragged-right]
4129 tempoPadded =
4130 #(define-music-function
4131      (parser location padding tempotext)
4132      (number? string?)
4133    #{
4134      \once \override Score.MetronomeMark #'padding = $padding
4135      \tempo \markup { \bold $tempotext }
4136    #})
4137
4138 \relative c'' {
4139   \tempo \markup { "Low tempo" }
4140   c4 d e f g1
4141   \tempoPadded #4.0 #"High tempo"
4142   g4 f e d c1
4143 }
4144 @end lilypond
4145
4146 @c TODO: add appropriate @@ref's here.