Skip to content

Commit

Permalink
Change --lyric-height to --lyric-height-factor
Browse files Browse the repository at this point in the history
  • Loading branch information
lpugin committed Jan 6, 2025
1 parent b4d0d07 commit 4cd183c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 18 deletions.
2 changes: 1 addition & 1 deletion include/vrv/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 4 additions & 6 deletions src/adjustfloatingpositionerfunctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
6 changes: 3 additions & 3 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 2 additions & 8 deletions src/view_element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4cd183c

Please sign in to comment.