feat: use Worte/Weise labels and render metadata at page bottom (Closes #5)

Add metadata_labels ("abbreviated"/"german") and metadata_position
("top"/"bottom") options to LayoutConfig. German labels use "Worte:" and
"Weise:" instead of "T:" and "M:", with "Worte und Weise:" when lyricist
and composer are the same person. Metadata at bottom position renders
after notes with word-wrapping. MeasurementEngine accounts for two-line
metadata in German label mode.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit was merged in pull request #12.
This commit is contained in:
shahondin1624
2026-03-17 09:41:48 +01:00
committed by shahondin1624
parent 8dca7d7131
commit b339c10ca0
4 changed files with 106 additions and 17 deletions

View File

@@ -15,9 +15,16 @@ class MeasurementEngine(
// Title height
heightMm += fontMetrics.measureLineHeight(config.fonts.title, config.fonts.title.size) * 1.5f
// Metadata line (composer/lyricist)
// Metadata lines (composer/lyricist) - may be 1 or 2 lines depending on label style
if (song.composer != null || song.lyricist != null) {
heightMm += fontMetrics.measureLineHeight(config.fonts.metadata, config.fonts.metadata.size) * 1.8f
val metaLineHeight = fontMetrics.measureLineHeight(config.fonts.metadata, config.fonts.metadata.size) * 1.8f
val useGerman = config.layout.metadataLabels == "german"
if (useGerman && song.lyricist != null && song.composer != null && song.lyricist != song.composer) {
// Two separate lines: "Worte: ..." and "Weise: ..."
heightMm += metaLineHeight * 2
} else {
heightMm += metaLineHeight
}
}
// Key/capo line