make customEps path resolution more robust

This commit is contained in:
tux
2026-07-01 17:58:10 +02:00
parent 40f483bc67
commit 50e08220c4
2 changed files with 15 additions and 5 deletions
@@ -6,10 +6,20 @@
#(define-markup-command (customEps layout props ysize filename)(number? string?)
#:properties ((songfilename ""))
(interpret-markup layout props
(let ((defaulttitlemarkup (ly:output-def-lookup layout 'defaultTitleMarkup))
(filepath (if (string-null? songfilename)
filename
(ly:format "~a/~a/~a" songPath songfilename filename))))
(let* ((defaulttitlemarkup (ly:output-def-lookup layout 'defaultTitleMarkup))
;; Determine the song directory to resolve the EPS relative to.
;; In TEXT the name arrives via the markup props (\setsongfilename),
;; but inside MUSIC (e.g. \mark) the props do not carry it, so we
;; fall back to the value stored in the score's \layout block.
(layout-songfilename (ly:output-def-lookup layout 'songfilename #f))
(songdir (cond ((not (string-null? songfilename)) songfilename)
((and (string? layout-songfilename)
(not (string-null? layout-songfilename)))
layout-songfilename)
(else #f)))
(filepath (if songdir
(ly:format "~a/~a/~a" songPath songdir filename)
filename)))
(if (file-exists? filepath)
(make-epsfile-markup Y ysize filepath)
(if defaulttitlemarkup
+1 -1
View File
@@ -205,7 +205,7 @@ songs =
\bookpart {
$header
\headerToTOC #header #label
\score { $music \layout { $layout } }
\score { $music \layout { $layout songfilename = $(symbol->string filename) } }
$(add-text-pages text-pages)
}
#}))))))