abcjs icon indicating copy to clipboard operation
abcjs copied to clipboard

Need way to draw repeate bars

Open SteveALee opened this issue 5 years ago • 7 comments

The standard measure repeat symbol of a % sign cannot be added, at least I found no way.

I see abs2svg supports a repeat directive dn perhasp that would be good.

I can see the midi player will nedd to have logic added to support them though.

SteveALee avatar Jun 01 '20 15:06 SteveALee

That's a good feature, but I haven't implemented it yet.

paulrosen avatar Jun 02 '20 17:06 paulrosen

I had a look at the source but it would take me quite a while to figure it :)

SteveALee avatar Jun 02 '20 18:06 SteveALee

Hi, I have asked the same in another thread about a year ago. If you give me a hint of how to get started with creating symbols ill have a go at it. Maybe we can join forces steve?

ThorsenRune avatar Jun 05 '20 16:06 ThorsenRune

The first thing for creating a symbol is create an SVG path of the symbol using only relative coordinates. You might start with an existing glyph like the chord rhythm glyph. Here's an example of it manifested:

<path d="m 656.0636265573457 101.36562500000001c 0.06 -0.06 0.18 -0.06 1.71 -0.06l 1.65 0l 0.09 0.09c 0.06 0.06 0.06 0.09 0.06 0.15c -0.03 0.12 -9.21 15.24 -9.3 15.33c -0.06 0.06 -0.18 0.06 -1.71 0.06l -1.65 0l -0.09 -0.09c -0.06 -0.06 -0.06 -0.09 -0.06 -0.15c 0.03 -0.12 9.21 -15.24 9.3 -15.33z" stroke="none" fill="#000000" class=""></path>

The next step is to change the format to what the abc_glyphs.js file needs. This is an area that needs a lot of documentation, and probably some refactoring. I have to figure it out again every time. Sorry about that.

Then to use it, the %%repeat command needs to be supported: see abc_parse_directive.js.

Then to show it, I'd have to research it a little. There's a folder write that it would have it. I am also in the process of refactoring the files in that folder, too, so changing them now will have merge conflicts.

For playback, it is abc_midi_sequencer.js and abc_midi_flattener.js.

paulrosen avatar Jun 05 '20 18:06 paulrosen

This is the hackiest of workarounds and creates the appearance of a repeated measure only (obviously will not work with the MIDI sequencer). It requires manual tuning and Unicode (1D10E is the symbol):

%%annotationfont 24
| y "@-16,-30𝄎"y |

The screenshot shows how this looks on my sheet music: image

You'll need to tweak the font size, use a Unicode-supporting font family, and then tune x (-16) and y (-30) until it's where you want. Only one of the spacers is necessary, but I started from trying to put the percent symbol between spacers, which didn't work well for multiple reasons. If this can be put into a macro, that would really clean up the appearance, but I believe only ornamentation between exclamation points can work with U:, and I don't know how to get m: to work.

PennRobotics avatar May 31 '22 16:05 PennRobotics

Interesting! Thanks for the effort on this.

I really need to implement this for real. I've bumped it up on my list.

paulrosen avatar Jun 07 '22 16:06 paulrosen

Please, implement the %-bar repeat sign! 🙏

VKondakoff avatar Feb 26 '24 20:02 VKondakoff