Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lyric improvements #3905

Merged
merged 9 commits into from
Jan 6, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change --lyric-height to --lyric-height-factor
lpugin committed Jan 6, 2025
commit 4cd183c7a789d3495f018826b4ab586a6e2a8ee4
2 changes: 1 addition & 1 deletion include/vrv/options.h
Original file line number Diff line number Diff line change
@@ -714,7 +714,7 @@ class Options {
OptionDbl m_ledgerLineThickness;
OptionDbl m_ledgerLineExtension;
OptionIntMap m_lyricElision;
OptionDbl m_lyricHeight;
OptionDbl m_lyricHeightFactor;
OptionDbl m_lyricLineThickness;
OptionBool m_lyricNoStartHyphen;
OptionDbl m_lyricSize;
10 changes: 4 additions & 6 deletions src/adjustfloatingpositionerfunctor.cpp
Original file line number Diff line number Diff line change
@@ -37,12 +37,10 @@ FunctorCode AdjustFloatingPositionersFunctor::VisitStaffAlignment(StaffAlignment
if (m_classId == SYL) {
const bool verseCollapse = m_doc->GetOptions()->m_lyricVerseCollapse.GetValue();
if (staffAlignment->GetVerseCount(verseCollapse) > 0) {
int verseHeight = (int)m_doc->GetOptions()->m_lyricHeight.GetValue() * drawingUnit;
if (verseHeight == 0) {
FontInfo *lyricFont = m_doc->GetDrawingLyricFont(staffAlignment->GetStaff()->m_drawingStaffSize);
verseHeight -= m_doc->GetTextGlyphDescender(L'q', lyricFont, false);
verseHeight += m_doc->GetTextGlyphHeight(L'I', lyricFont, false);
}
FontInfo *lyricFont = m_doc->GetDrawingLyricFont(staffAlignment->GetStaff()->m_drawingStaffSize);
int verseHeight = m_doc->GetTextGlyphHeight(L'I', lyricFont, false)
- m_doc->GetTextGlyphDescender(L'q', lyricFont, false);
verseHeight *= m_doc->GetOptions()->m_lyricHeightFactor.GetValue();
if (staffAlignment->GetVerseCountAbove(verseCollapse)) {
int margin = m_doc->GetTopMargin(SYL) * drawingUnit;
int minMargin = std::max((int)(m_doc->GetOptions()->m_lyricTopMinMargin.GetValue() * drawingUnit),
6 changes: 3 additions & 3 deletions src/options.cpp
Original file line number Diff line number Diff line change
@@ -1371,9 +1371,9 @@ Options::Options()
m_lyricElision.Init(ELISION_regular, &Option::s_elision);
this->Register(&m_lyricElision, "lyricElision", &m_generalLayout);

m_lyricHeight.SetInfo("Lyric height", "The lyric verse line height in MEI units (0.0 for the default text height)");
m_lyricHeight.Init(0.0, 0.0, 20.0);
this->Register(&m_lyricHeight, "lyricHeight", &m_generalLayout);
m_lyricHeightFactor.SetInfo("Lyric height factor", "The lyric verse line height factor");
m_lyricHeightFactor.Init(1.0, 1.0, 20.0);
this->Register(&m_lyricHeightFactor, "lyricHeightFactor", &m_generalLayout);

m_lyricLineThickness.SetInfo("Lyric line thickness", "The lyric extender line thickness");
m_lyricLineThickness.Init(0.25, 0.10, 0.50);
10 changes: 2 additions & 8 deletions src/view_element.cpp
Original file line number Diff line number Diff line change
@@ -2105,21 +2105,15 @@ int View::GetSylYRel(int verseN, Staff *staff, data_STAFFREL place)
StaffAlignment *alignment = staff->GetAlignment();
if (!alignment) return 0;

const int drawingUnit = m_doc->GetDrawingUnit(staff->m_drawingStaffSize);

const bool verseCollapse = m_options->m_lyricVerseCollapse.GetValue();
int y = 0;

FontInfo *lyricFont = m_doc->GetDrawingLyricFont(staff->m_drawingStaffSize);
const int descender = m_doc->GetTextGlyphDescender(L'q', lyricFont, false);
const int height = m_doc->GetTextGlyphHeight(L'I', lyricFont, false);

int verseHeight = (int)m_doc->GetOptions()->m_lyricHeight.GetValue() * drawingUnit;
if (verseHeight == 0) {
verseHeight -= descender;
verseHeight += height;
}

int verseHeight = height - descender;
verseHeight *= m_doc->GetOptions()->m_lyricHeightFactor.GetValue();
int margin = m_doc->GetBottomMargin(SYL) * m_doc->GetDrawingUnit(staff->m_drawingStaffSize);

// above the staff