layout.txt - abc2ps - A powerful sheet setting tool using the simple abc notati… | |
git clone git://vernunftzentrum.de/abc2ps.git | |
Log | |
Files | |
Refs | |
--- | |
layout.txt (7123B) | |
--- | |
1 | |
2 | |
3 How the notes are arranged on the staff in abc2ps | |
4 ================================================= | |
5 | |
6 This file contains more detailed information on the way in which | |
7 the layout is calculated in abc2ps, for those who are interested | |
8 or would like to change the layout. | |
9 | |
10 | |
11 ----- General points ----- | |
12 | |
13 When typesetting music, an important feature is presumably | |
14 that notes and rests are arranged in some way which indicates | |
15 the note durations. The following considerations entered | |
16 into abc2ps: | |
17 | |
18 (a) The space assigned a note should be qualitatively proportional | |
19 to its durations, but this mapping should not be strictly linear. | |
20 It seems best to "saturate" the mapping so that whole notes | |
21 are somewhat less than twice as wide as half notes. At the other | |
22 end, the width allocated to 8th and 16th notes must be | |
23 more similar than a factor of 1/2 or the layout looks uneven. | |
24 Thus, for durations approaching zero the note width should go | |
25 to some constant. A modifiable function nwidth(len) defines | |
26 the mapping. | |
27 | |
28 (b) Given a sequence of notes (or rests) within a bar, the space | |
29 between any two should reflect the duration of the first. | |
30 If this is done strictly, the distance along the staff becomes | |
31 the correct "time axis" but the output looks uneven. | |
32 Therefore there is an "asymmetry" parameter beta to adjust. | |
33 For beta=0, the internote spacing comes equally from both neighbor | |
34 notes, and for beta=1 only the first note of each pair is taken | |
35 into account. | |
36 | |
37 (c) When notes are grouped under a beam, they are moved slightly | |
38 closer together. | |
39 | |
40 (d) The spacing between a note at the start of a measure and the | |
41 preceding bar line is a separate case. On the one hand, the duration | |
42 of the note could influence the spacing. On the other hand, | |
43 music often seems to be written with this spacing some fixed standard | |
44 distance. The treatment here is to choose a standard space (eg. some | |
45 fraction of a full measure) and another tuning parameter beta. For be… | |
46 the standard distance is used, and for beta=1 the space is taken from | |
47 the note duration. Notes at the end of a measure are treated similari… | |
48 | |
49 (e) If a measure has only one note in it, one can put the note exactl… | |
50 into the middle and calculate the measure width from the note duratio… | |
51 Alternatively, this case can be treated like case (d) as a bar-note | |
52 and a note-bar case. A further parameter interpolates between these | |
53 alternatives. | |
54 | |
55 | |
56 ----- Puristic layout ----- | |
57 | |
58 To change the layout rules, the parameters in file "style.h" should | |
59 be modified. As a starting point, it is useful to consider a strict | |
60 layout defined as follows (see file "style.pure"): | |
61 | |
62 (a) Make the mapping between note length and the space on the paper l… | |
63 | |
64 (b) Make the space between two notes exactly proportional to the leng… | |
65 of the first note. | |
66 | |
67 (c) Do not move notes under beams closer together. | |
68 | |
69 (d) Put notes at the start of a measure at a fixed distance behind th… | |
70 Put a bar behind a note at a spacing proportional to the note len… | |
71 | |
72 (e) Treat a measure with a single note in it like case (d). | |
73 | |
74 For this layout, the position of each note exactly gives the time when | |
75 the note starts. It looks more or less like what one wants, but it is | |
76 too strict for good readability. One way to get suitable layout | |
77 parameters is to start from the settings in "style.pure" and twiddle | |
78 on the parameters. | |
79 | |
80 | |
81 ----- Algorithm for filling out the staffs ----- | |
82 | |
83 This is similar to the procedure used by Knuth in TeX | |
84 as described in the TeXBook, chapter on "Glue". | |
85 Three different sets of spacings are defined: shrink, space, stretch. | |
86 | |
87 shrink: the smallest acceptable spacings. These are controlled | |
88 by function set_sym_widths(). | |
89 space: prefered "natural" spacings at which layout looks best. | |
90 All parameters in style.h ending in 'p' are relevant. | |
91 stretch: spacings for an expanded "stretched" layout. | |
92 All parameters in style.h ending in 'x' are relevant. | |
93 | |
94 To set a line, the natural spacings are added together. If the sum is | |
95 larger than the desired staff length, the final spacings are obtained | |
96 by linear interpolation between the "shrink" and "space" values. | |
97 If the sum is smaller, the spacings are obtained by interpolating | |
98 between the "space" and "stretch" values. Compression does not go | |
99 beyond the "shrink" spacings but expansion is allowed to any width. | |
100 (Formal note: the definition of shrink and stretch used here is not | |
101 the same as in TeX; eg. the minimal spacing is here 'shrink' | |
102 whereas in TeX it is 'space-shrink'.) | |
103 | |
104 | |
105 ----- How to proceed when changing the layout ----- | |
106 | |
107 When changing the output appearance, the important thing is to modify | |
108 the three glue modes "shrink", "space", and "stretch" separately. | |
109 Since a typical music line is a mixture of these modes, it is | |
110 difficult to see what is happening when changing the parameters | |
111 in the "fill" mode. In detail: | |
112 | |
113 (1) Use info field 'E:shrink' or the flag "-g shrink" to force | |
114 maximally compressed output. In this mode, no extra glue is put | |
115 between the symbols. The layout should be as compressed as possible | |
116 while still being acceptable. The spacings are here given by | |
117 the left and right widths wl,wr which are defined in routine | |
118 set_sym_widths(). These are presently set so that symbols | |
119 have a small space around them, taking into account dots, flags, | |
120 accidentals etc. Slightly more space is left around open notes and | |
121 fat bars. | |
122 | |
123 (2) Next, use 'E:space' or "-g space" to force the prefered natural | |
124 spacing. This layout should be adjusted to get the ouput which looks | |
125 best. As in case (1), there are left and right widths for each symbol, | |
126 now called pl and pr, which are also set in set_sym_widths(). | |
127 The important difference is that spacings around notes and rests | |
128 are influenced by the durations. This is done according | |
129 to the rules described above, using the parameters ending in 'p' | |
130 in style.h. The relevant routine is set_sym_poslist(). | |
131 | |
132 (3) Finally, use 'E:stretch' to force stretched output. | |
133 This output should be something like twice as wide but should still b… | |
134 easily readable. For example, this implies that internote spacings ar… | |
135 more even than in the "space" mode. Internally, the stretched spacing… | |
136 are calculated exactly as the prefered spacings, using left and right | |
137 widths xl and xr, function xwidth(len), and the parameters ending | |
138 in 'x' in style.h. | |
139 | |
140 The idea is that after obtaining satisfactory layouts for the shrink, | |
141 space, and stretch modes separately, the output should look good | |
142 when the spacings are interpolated to fill out the staff. | |
143 | |
144 If you change the style file to your tastes, you might as well | |
145 give the layout a new name, by changing the macro STYLE in style.h. | |
146 This is so that the command 'abc2ps -V' can show what style is | |
147 currently being used. | |
148 | |
149 | |
150 Michael Methfessel, Feb 1996. |