feat: support custom font files for song titles (Closes #4)

- Improve PdfFontMetrics: use canonical path for cache key, validate
  font file existence, use absolute paths for BaseFont.createFont
- Add font file path resolution in SongbookPipeline (relative to
  project directory)
- Add font file existence validation in Validator.validateConfig
- Add end-to-end tests: custom font loading, umlaut rendering,
  cache deduplication, missing file error
- Document custom font file usage in example songbook.yaml

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit was merged in pull request #14.
This commit is contained in:
shahondin1624
2026-03-17 09:54:15 +01:00
parent b339c10ca0
commit ab91ad2db6
8 changed files with 205 additions and 6 deletions

View File

@@ -14,6 +14,11 @@ fonts:
title: { family: "Helvetica", size: 14 }
metadata: { family: "Helvetica", size: 8 }
toc: { family: "Helvetica", size: 9 }
# To use a custom font file (e.g. Fraktur/Blackletter for titles):
# title: { file: "./fonts/FrakturFont.ttf", size: 16 }
# The file path is relative to the project directory.
# Supported formats: .ttf, .otf
# Custom fonts are embedded in the PDF and support Unicode (including umlauts).
layout:
margins: { top: 15, bottom: 15, inner: 20, outer: 12 }