Offset in y position for text element.

• Sep 23, 2019 - 09:22

Dear all,
I'm trying to add an offset for a text element in y position. The corresponding part in my macro are lines below. However, the commands with offsetX and offsetY don't seem to have any effect. What am I doing wrong? Thanks for your help! The whole macro is attached. Cheers, Philipp

var text = newElement(Element.STAFF_TEXT);
var fontSizeTag="";
text.text = fontSizeTag+fingering;

text.offsetX= xPos;
text.offsetY = (cursor.element.notes.length - 1)*offsetFactor;//yPos;
text.placement = textposition;
text.autoplace = false;

cursor.add(text);

Attachment Size
FlötenGriffe.qml 7.88 KB

Comments

I am in the same situation with the Shakuhachi notation etc.

text.placement = Placement.below
works, but offsetX and offsetY don't work, so all accidental notation overlaps the same place.

That looks like a bug actually, the code you show is intended to work. There seems to be a workaround though: if you set placement and offset after adding the element to a score, those parameters become set properly:

cursor.add(text);
text.placement = Placement.BELOW;
text.offsetX = 1.2;
text.offsetY = 3.4;

Do you still have an unanswered question? Please log in first to post your question.