Skip to content

Commit

Permalink
write bezier points
Browse files Browse the repository at this point in the history
  • Loading branch information
rettinghaus committed Feb 18, 2025
1 parent ed33c7f commit 5b1dc0b
Showing 1 changed file with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,30 @@ static String slurTieLineStyle(const SlurTie* s)
return rest;
}

static String slurBezier(const Slur* s, const bool start)
{
if (!ExportMusicXml::configuration()->exportLayout()) {
return String();
}

String rest;
const int spatium = s->spatium();
if (start) {
const SlurSegment* front = s->frontSegment();
const PointF start = front->ups(Grip::START).pos();
const PointF bezier = front->ups(Grip::BEZIER1).pos();
rest += String(u" bezier-x=\"%1\"").arg(10 * (bezier.x() - start.x()) / spatium);
rest += String(u" bezier-y=\"%1\"").arg(-10 * bezier.y() / spatium);
} else {
const SlurSegment* back = s->backSegment();
const PointF end = back->ups(Grip::END).pos();
const PointF bezier = back->ups(Grip::BEZIER2).pos();
rest += String(u" bezier-x=\"%1\"").arg(10 * (bezier.x() - end.x()) / spatium);
rest += String(u" bezier-y=\"%1\"").arg(-10 * bezier.y() / spatium);
}
return rest;
}

//---------------------------------------------------------
// findSlur -- get index of slur in slur table
// return -1 if not found
Expand Down Expand Up @@ -919,7 +943,7 @@ void SlurHandler::doSlurStart(const Slur* s, Notations& notations, XmlWriter& xm
String tagName = u"slur";
tagName += u" type=\"start\"";
tagName += slurTieLineStyle(s);
tagName += ExportMusicXml::positioningAttributes(s, true);
tagName += slurBezier(s, true);

if (i >= 0) {
// remove from list and print start
Expand Down Expand Up @@ -965,7 +989,7 @@ void SlurHandler::doSlurStop(const Slur* s, Notations& notations, XmlWriter& xml
m_started[i] = false;
notations.tag(xml, s);
String tagName = String(u"slur type=\"stop\" number=\"%1\"").arg(i + 1);
tagName += ExportMusicXml::positioningAttributes(s, false);
tagName += slurBezier(s, false);
xml.tagRaw(tagName);
} else {
LOGD("no free slur slot");
Expand All @@ -976,7 +1000,7 @@ void SlurHandler::doSlurStop(const Slur* s, Notations& notations, XmlWriter& xml
m_started[i] = false;
notations.tag(xml, s);
String tagName = String(u"slur type=\"stop\" number=\"%1\"").arg(i + 1);
tagName += ExportMusicXml::positioningAttributes(s, false);
tagName += slurBezier(s, false);
xml.tagRaw(tagName);
}
}
Expand Down

0 comments on commit 5b1dc0b

Please sign in to comment.