Skip to content

Commit 74a131c

Browse files
committed
add drawing of turn enclosing
1 parent fe52f5c commit 74a131c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/view_control.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2912,6 +2912,9 @@ void View::DrawTurn(DeviceContext *dc, Turn *turn, Measure *measure, System *sys
29122912
// set norm as default
29132913
int code = turn->GetTurnGlyph();
29142914

2915+
char32_t enclosingFront, enclosingBack;
2916+
std::tie(enclosingFront, enclosingBack) = turn->GetEnclosingGlyphs();
2917+
29152918
data_HORIZONTALALIGNMENT alignment = HORIZONTALALIGNMENT_center;
29162919
// center the turn only with @startid
29172920
if (turn->GetStart()->Is(TIMESTAMP_ATTR)) {
@@ -2961,13 +2964,26 @@ void View::DrawTurn(DeviceContext *dc, Turn *turn, Measure *measure, System *sys
29612964
dc, x + accidXShift, accidY, accidStr, HORIZONTALALIGNMENT_center, staffSize / 2, false);
29622965
}
29632966

2967+
if (enclosingFront) {
2968+
int xCorrEncl = m_doc->GetGlyphWidth(enclosingFront, staffSize, false);
2969+
if (!turn->GetStart()->Is(TIMESTAMP_ATTR)) xCorrEncl += turnWidth /2;
2970+
this->DrawSmuflCode(dc, x - xCorrEncl, y + turnHeight / 2, enclosingFront, staffSize, false);
2971+
}
2972+
29642973
if (symbolDef) {
29652974
this->DrawSymbolDef(dc, turn, symbolDef, x, y, staffSize, false, alignment);
29662975
}
29672976
else {
29682977
this->DrawSmuflString(dc, x, y, str, alignment, staffSize);
29692978
}
29702979

2980+
if (enclosingBack) {
2981+
int xCorrEncl = turnWidth + m_doc->GetGlyphWidth(enclosingBack, staffSize, false)
2982+
- m_doc->GetGlyphAdvX(enclosingBack, staffSize, false);
2983+
if (!turn->GetStart()->Is(TIMESTAMP_ATTR)) xCorrEncl -= turnWidth /2;
2984+
this->DrawSmuflCode(dc, x + xCorrEncl, y + turnHeight / 2, enclosingBack, staffSize, false);
2985+
}
2986+
29712987
dc->ResetFont();
29722988
}
29732989

0 commit comments

Comments
 (0)