vexflow
vexflow copied to clipboard
How to set repeat at beginning of bar w/o stave's start/left barline
I'm trying to achieve the following: https://en.wikipedia.org/wiki/Repetition_(music)#/media/File:Au_clair_de_la_lune_repetition.png
ie have a left/start repeat sign but without having the stave's left/begin barline. Is this possible?
When i set the stave's begin barline to repeat (stave.setBegBarType(4)) it automatically adds a barline in the beginning of the stave (ie left side).
Cheers, Nitzan
ie have a left/start repeat sign but without having the stave's left/begin barline
I don't see that in the image you linked. But I guess what you wrote is what you want to achieve.
Sorry, here is a decent screenshot :)
@nitzanrh could you provide the code and a screenshot of what you are actually getting?
Yup, here is a jsfiddle: https://jsfiddle.net/j5asuce8/
code:
VF = Vex.Flow;
// Create an SVG renderer and attach it to the DIV element named "boo".
var div = document.getElementById("boo")
var renderer = new VF.Renderer(div, VF.Renderer.Backends.SVG);
// Configure the rendering context.
renderer.resize(500, 500);
var context = renderer.getContext();
context.setFont("Arial", 10, "").setBackgroundFillStyle("#eed");
// Create a stave of width 400 at position 10, 40 on the canvas.
var stave = new VF.Stave(10, 40, 400);
stave.setBegBarType(4)
// Add a clef and time signature.
stave.addClef("treble").addTimeSignature("4/4");
// Connect it to the rendering context and draw!
stave.setContext(context).draw();
SS:
@nitzanrh I have been reviewing issues and I realised that I missed this one. Thaks for the jsfiddle! It helped a lot. The behaviour is hard coded:
case BarlineType.REPEAT_BEGIN:
// If the barline is shifted over (in front of clef/time/key)
// Draw vertical bar at the beginning.
this.drawRepeatBar(stave, this.x, true);
if (stave.getX() !== this.x) {
this.drawVerticalBar(stave, stave.getX());
}
break;
I could add a REPEAT_BEGIN_NONE removing the bar at the beginning:
case BarlineType.REPEAT_BEGIN_NONE:
this.drawRepeatBar(stave, this.x, true);
break;
would that help? Please note that you would still get the repeat bar after the time signature and not before (as shown in the example you provide)
Hi @rvilarl, thanks for your reply :) Yeah I believe that would help. Personally I find the name REPEAT_BEGIN_NONE slightly confusing, but as long as the documentation is clear then that shouldn't be a problem.
Regarding the time signature; personally I wouldn't cause any problems with my usage for Vexflow, however I think that if you follow the strict "rules" of music notation then the barlines should appear before the time signature.
Cheers, Nitzan