Skip to content

Commit

Permalink
Fix flipped syl
Browse files Browse the repository at this point in the history
  • Loading branch information
yinanazhou committed Apr 18, 2024
1 parent 4cd1890 commit 7c03572
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/view_element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1743,7 +1743,9 @@ void View::DrawSyl(DeviceContext *dc, LayerElement *element, Layer *layer, Staff
return;
}

syl->SetDrawingYRel(this->GetSylYRel(syl->m_drawingVerse, staff));
if (m_doc->IsFacs()) {
syl->SetDrawingYRel(this->GetSylYRel(syl->m_drawingVerse, staff));
}

dc->StartGraphic(syl, "", syl->GetID());
dc->DeactivateGraphicY();
Expand Down
13 changes: 7 additions & 6 deletions src/view_text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,21 +271,21 @@ void View::DrawLyricString(
std::u32string syl = U"";
std::u32string lyricStr = str;

const int x = (params) ? params->m_x : VRV_UNSET;
const int y = (params) ? params->m_y : VRV_UNSET;
const int dcX = (params) ? ToDeviceContextX(params->m_x) : VRV_UNSET;
const int dcY = (params) ? ToDeviceContextY(params->m_y) : VRV_UNSET;
const int width = (params) ? params->m_width : VRV_UNSET;
const int height = (params) ? params->m_height : VRV_UNSET;

if (m_doc->GetOptions()->m_lyricElision.GetValue() == ELISION_unicode) {
std::replace(lyricStr.begin(), lyricStr.end(), U'_', UNICODE_UNDERTIE);
dc->DrawText(UTF32to8(lyricStr), lyricStr, x, y, width, height);
dc->DrawText(UTF32to8(lyricStr), lyricStr, dcX, dcY, width, height);
}
else {
while (lyricStr.compare(syl) != 0) {
wroteText = true;
auto index = lyricStr.find_first_of(U"_");
syl = lyricStr.substr(0, index);
dc->DrawText(UTF32to8(syl), syl, x, y, width, height);
dc->DrawText(UTF32to8(syl), syl, dcX, dcY, width, height);

// no _
if (index == std::string::npos) break;
Expand All @@ -298,7 +298,7 @@ void View::DrawLyricString(
bool isFallbackNeeded = (m_doc->GetResources()).IsSmuflFallbackNeeded(elision);
vrvTxt.SetSmuflWithFallback(isFallbackNeeded);
dc->SetFont(&vrvTxt);
dc->DrawText(UTF32to8(elision), elision, x, y, width, height);
dc->DrawText(UTF32to8(elision), elision, dcX, dcY, width, height);
dc->ResetFont();

// next syllable
Expand All @@ -310,7 +310,8 @@ void View::DrawLyricString(
// This should only be called in facsimile mode where a zone is specified but there is
// no text. This draws the bounds of the zone but leaves the space blank.
if (!wroteText && params) {
dc->DrawText("", U"", params->m_x, params->m_y, params->m_width, params->m_height);
dc->DrawText(
"", U"", ToDeviceContextX(params->m_x), ToDeviceContextY(params->m_y), params->m_width, params->m_height);
}
}

Expand Down

0 comments on commit 7c03572

Please sign in to comment.