Skip to content

Add text to the left of the stave? #1424

Answered by sschmidTU
mtoneil asked this question in Q&A
Discussion options

You must be logged in to vote

I would just use ctx.fillText(text, x, y), that's how OSMD does it.

some settings you can set beforehand:

ctx.setFont(fontFamilyVexFlow, fontHeight, VexFlowConverter.fontStyle(fontStyle));
// font size is set by VexFlow in `pt`. This overwrites the font so it's set to px instead
ctx.attributes["font-size"] = `${fontHeight}px`;
ctx.state["font-size"] = `${fontHeight}px`;

(this is for Vexflow 1.2.93, might have changed in Vexflow 4)

You should be able to get the left-most x and y position of the stave somehow.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@AaronDavidNewman
Comment options

@mtoneil
Comment options

Answer selected by mtoneil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants