fix pdf page numbering
This commit is contained in:
@@ -242,13 +242,23 @@
|
||||
`(line-width . ,(* (chain-assoc-get 'header:songinfo-size-factor props songInfoLineWidthFraction) (ly:output-def-lookup layout 'line-width)))
|
||||
arg)))
|
||||
|
||||
#(define pdf-encode (@@ (lily framework-ps) pdf-encode))
|
||||
% PDF tags
|
||||
#(define-markup-command (page-number-to-pdf-label layout props) ()
|
||||
(ly:make-stencil
|
||||
(list 'embedded-ps
|
||||
(ly:format
|
||||
"[ /Label (~a) /PAGELABEL pdfmark\n" (pdf-encode (chain-assoc-get 'page:page-number-string props "?"))))
|
||||
empty-interval empty-interval
|
||||
))
|
||||
|
||||
\paper {
|
||||
print-first-page-number = ##t
|
||||
first-page-number = #0
|
||||
|
||||
oddFooterMarkup = \markup {
|
||||
\fill-line {
|
||||
\line { \null }
|
||||
\line { \page-number-to-pdf-label \null }
|
||||
\line { \if \on-last-page-of-part \general-align #Y #DOWN \fractional-line-width \print-songinfo }
|
||||
\line { \if \should-print-page-number \print-pagenumber }
|
||||
}
|
||||
@@ -257,7 +267,7 @@
|
||||
\fill-line {
|
||||
\line { \if \should-print-page-number \print-pagenumber }
|
||||
\line { \if \on-last-page-of-part \general-align #Y #DOWN \fractional-line-width \print-songinfo }
|
||||
\line { \null }
|
||||
\line { \page-number-to-pdf-label \null }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,13 +28,15 @@
|
||||
#(define pdf-encode (@@ (lily framework-ps) pdf-encode))
|
||||
% PDF tags
|
||||
#(define-markup-command (title-to-pdf-toc layout props title) (string?)
|
||||
(if (string-null? title)
|
||||
empty-stencil
|
||||
(ly:make-stencil
|
||||
(list 'embedded-ps
|
||||
(ly:format
|
||||
"[/Action /GoTo /View [/XYZ -4 currentpagedevice /PageSize get 1 get 4 add null] /Title (~a) /OUT pdfmark" (pdf-encode title)))
|
||||
empty-interval empty-interval
|
||||
;'(0 . 0) '(0 . 0)
|
||||
))
|
||||
)))
|
||||
|
||||
#(define-markup-command (title-with-category-images layout props right)(boolean?)
|
||||
(interpret-markup layout props
|
||||
|
||||
@@ -65,7 +65,10 @@ additionalPageNumbers =
|
||||
display-pages-list
|
||||
)
|
||||
|
||||
|
||||
% TODO:
|
||||
% Eigentlich können wir das direkt in oddFooderMarkup und evenFooterMarkup aufrufen
|
||||
% vermutlich sogar ohne den delay kram. Wir sollten außerdem einfach nur die property
|
||||
% page:page-number-string setzen dann klappts auch mit PDF Seiten
|
||||
#(define-markup-command (custom-page-number layout props label real-current-page-number)
|
||||
(symbol? number?)
|
||||
#:category other
|
||||
@@ -89,9 +92,10 @@ width may require additional tweaking.)"
|
||||
,(delay (ly:stencil-expr
|
||||
(let* ((display-page (assq-ref (build-display-pages-list layout) label))
|
||||
(real-current-page (if (negative? real-current-page-number) (real-page-number layout label) real-current-page-number))
|
||||
(number-type (ly:output-def-lookup layout 'page-number-type))
|
||||
(page-markup
|
||||
(if (assq-ref additional-page-switch-label-list label)
|
||||
(make-concat-markup (list (number-format 'arabic display-page)
|
||||
(make-concat-markup (list (number-format number-type display-page)
|
||||
(make-char-markup (+ 97 (- real-current-page (real-page-number layout
|
||||
(let find-earliest-additional-label
|
||||
((rest-additional-page-switch-label-list (member (cons label #t) additional-page-switch-label-list)))
|
||||
@@ -99,7 +103,7 @@ width may require additional tweaking.)"
|
||||
(find-earliest-additional-label (cdr rest-additional-page-switch-label-list))
|
||||
(caar rest-additional-page-switch-label-list)))
|
||||
))))))
|
||||
(number-format 'arabic (+ display-page (- real-current-page (real-page-number layout label))))
|
||||
(number-format number-type (+ display-page (- real-current-page (real-page-number layout label))))
|
||||
))
|
||||
(page-stencil (interpret-markup layout props page-markup))
|
||||
(gap (- (interval-length x-ext)
|
||||
|
||||
Reference in New Issue
Block a user