moinejf / abc2svg

project moved to https://chiselapp.com/user/moinejf/repository/abc2svg
GNU Lesser General Public License v3.0
48 stars 7 forks source link

How to prevent lines of invisible notes from collapsing? #121

Closed chrisfargen closed 4 years ago

chrisfargen commented 4 years ago
%%beginps
/slashz { 12 sub M -6 20 RM 11 12 RL 4 0 RL -11 -12 RL -4 0 RL fill}!
%%endps
%%deco slashz 7 slashz 0 0 0
X: 182
T: Them there eyes
T: QHCF version
C: Pinkard, Tauber & Tracy
M: 4/4
L: 1/8
R: swing
K: Dmaj
Q: 1/4=200
U: s = !slashz!
U: i = !invisible!
%
P: A
"D" a2 fe de f2 | a2 fe de f2 | "C#7" b4 b3 b- | b4 z4 |
"D" a2 fe de f2 | a2 fe de f2 | "E-7" b4 b3 b- | "A7" b4 z4 |
"F#7" siz2 siz2  siz2 siz2 | siz2 siz2 siz2 siz2 | "B-" siz2 siz2 siz2 siz2 | siz2 siz2 siz2 siz2 |
"E7" siz2 siz2 siz2 siz2 | siz2 siz2 siz2 siz2 | "A7" siz2 siz2 siz2 siz2 | siz2 siz2 siz2 siz2 ||

I am trying to add slash notation for improvised sections of music. However, because I have used !invisible! decoration on all the contents within these lines, the line is not being shown at all. Below, there should be four lines of music in total.

out

Any suggestions appreciated. Thanks.

moinejf commented 4 years ago

Using invisible rests just bypassed the bug signalled in the issue #120. With the fix, the rests may be visible again, but an other problem is raised: the rests have a x offset in the page and this offset depends on the pitch of the last notes. The solution is to use a second voice for the slashes. Here is a way with a voice overlay:

`%%beginps /slashz {12 sub M -7 6 RM 11 12 RL 3 0 RL -11 -12 RL -3 0 RL fill}! %%endps %%deco head-slashz 7 slashz 0 0 0 U: s = !head-slashz!

X:1
M:4/4 L:1/8 K:C "D" a2 fe de f2 | a2 fe de f2 | "C#7" b4 b3 b- | b4 z4 | "D" a2 fe de f2 | a2 fe de f2 | "E-7" b4 b3 b- | "A7" b4 z4 | (& X4| X4| & "F#7" sz2 sz2 sz2 sz2 | sz2 sz2 sz2 sz2 | "B-" sz2 sz2 sz2 sz2 | sz2 sz2 sz2 sz2 | "E7" sz2 sz2 sz2 sz2 | sz2 sz2 sz2 sz2 | "A7" sz2 sz2 sz2 sz2 | sz2 sz2 sz2 sz2 || &)`

chrisfargen commented 4 years ago

@moinejf thanks for speedy reply.

I found another solution in the documentation: %%staffnonote 2 (always display the staves).

%%beginps
/slashz { 12 sub M -6 20 RM 11 12 RL 4 0 RL -11 -12 RL -4 0 RL fill }!
%%endps
%%deco slashz 7 slashz 0 0 0
X: 1
M: 4/4
L: 1/8
K: Dmaj
%
U: s = !slashz!
U: i = !invisible!
%
%%staffnonote 2
%
P: A
"D" a2 fe de f2 | a2 fe de f2 | "C#7" b4 b3 b- | b4 z4 |
"D" a2 fe de f2 | a2 fe de f2 | "E-7" b4 b3 b- | "A7" b4 z4 |
"F#7" siz2 siz2  siz2 siz2 | siz2 siz2 siz2 siz2 | "B-" siz2 siz2 siz2 siz2 | siz2 siz2 siz2 siz2 |
"E7" siz2 siz2 siz2 siz2 | siz2 siz2 siz2 siz2 | "A7" siz2 siz2 siz2 siz2 | siz2 siz2 siz2 siz2 ||

out