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