[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Signets de pages pdf
From: |
Ya Gloops |
Subject: |
Re: Signets de pages pdf |
Date: |
Sun, 4 Sep 2022 22:50:35 +0000 (UTC) |
Salut !
Je m'y prend mal quelque part mais je ne sais pas où...
\version "2.23.12"
\paper {
#(use-modules (ice-9 match)
(srfi srfi-1))
page-breaking =
#(lambda (paper-book)
(let* ((paper (ly:paper-book-paper paper-book))
(parent (ly:output-def-parent paper))
(top-paper (if (null? parent)
paper
parent))
(alist-before (ly:output-def-lookup top-paper 'label-page-table))
(result (ly:optimal-breaking paper-book))
(alist-after (ly:output-def-lookup top-paper 'label-page-table))
(alist-part (let loop ((after alist-after)
(acc '()))
(if (eq? after alist-before)
(reverse! acc)
(loop (cdr after)
(cons (car after)
acc)))))
(new-alist (let loop ((alist alist-part)
(acc '())
(same-pgnum '())
(last-pgnum #f))
(match alist
(()
(append-reverse same-pgnum acc))
(((label . page) . rest)
(if (or (not last-pgnum)
(eqv? last-pgnum page))
(loop rest
acc
(acons label page same-pgnum)
page)
(loop rest
(append-reverse same-pgnum acc)
(list (cons label page))
page)))))))
(ly:output-def-set-variable! top-paper 'label-page-table (append-reverse
new-alist alist-before))
result))
}
% Voir https://lists.gnu.org/archive/html/lilypond-user-fr/2022-08/msg00074.html
% et https://gitlab.com/lilypond/lilypond/-/issues/6355
#(let ((default-table-of-contents make-table-of-contents-markup-list))
(define-markup-list-command (table-of-contents layout props) ()
(let* ((result (interpret-markup-list layout props
(default-table-of-contents)))
(alist (ly:output-def-lookup layout 'label-alist-table))
(parent (ly:output-def-parent layout)))
(when (not (null? parent))
(ly:output-def-set-variable! parent 'label-alist-table alist))
result)))
#(use-modules (ice-9 match))
#(define (group-to-fill-partial-sums lst weight threshold initial)
(let loop ((lst lst)
(i 0)
(partial-sum (initial 0))
(acc '()))
(match lst
(()
(reverse! (map reverse! acc)))
((elt . rest)
(let* ((elt-weight (weight elt))
(new-sum (+ partial-sum elt-weight)))
(cond
((null? acc)
(loop rest i new-sum (list (list elt))))
((<= new-sum threshold)
(loop rest i new-sum (cons (cons elt (car acc))
(cdr acc))))
(else
(loop rest
(1+ i)
(+ (initial (1+ i))
elt-weight)
(cons (list elt)
acc)))))))))
#(define (index-map f . lsts)
(let loop ((lsts lsts)
(i 0))
(if (any null? lsts)
'()
(cons (apply f i (map car lsts))
(loop (map cdr lsts)
(1+ i))))))
#(ly:register-stencil-expression 'new-toc-group)
#(define-markup-command (new-toc-group layout props arg) (markup?)
(let* ((stil (interpret-markup layout props arg))
(expr (ly:stencil-expr stil))
(x (ly:stencil-extent stil X))
(y (ly:stencil-extent stil Y)))
(ly:make-stencil `(new-toc-group ,expr)
x
y)))
#(define-markup-list-command (multicolumn-toc layout props columns) (index?)
#:properties ((baseline-skip)
(padding 5)
(line-width))
(let ((width (/ (- line-width (* padding (1- columns)))
columns))
(height (- (ly:output-def-lookup layout 'paper-height)
(ly:output-def-lookup layout 'top-margin)
(ly:output-def-lookup layout 'bottom-margin))))
(let ((mkup (ly:output-def-lookup layout 'tocItemMarkup)))
(ly:output-def-set-variable! layout 'tocItemMarkup (make-override-markup
`(line-width .
,width)
mkup)))
(match-let*
(((title . ungrouped-unfiltered-stils)
(interpret-markup-list layout
props
(make-table-of-contents-markup-list)))
(ungrouped-stils (remove ly:stencil-empty? ungrouped-unfiltered-stils))
(stils
(let loop ((ungrouped-stils ungrouped-stils)
(group '())
(acc '()))
(match ungrouped-stils
(()
(reverse!
(map (lambda (group-elts)
(let ((rev-group-elts (reverse! group-elts)))
(stack-stencils Y DOWN baseline-skip rev-group-elts)))
(cons group acc))))
((stil . rest)
(match (ly:stencil-expr stil)
(('new-toc-group expr)
(let* ((x (ly:stencil-extent stil X))
(y (ly:stencil-extent stil Y))
(unwrapped (ly:make-stencil expr x y)))
(loop rest
(list unwrapped)
(cons group acc))))
(_
(loop rest
(cons stil group)
acc)))))))
(split (group-to-fill-partial-sums
stils
(lambda (stil)
(+ (interval-length (ly:stencil-extent stil Y))
baseline-skip))
height
(let ((title-height (interval-length (ly:stencil-extent title
Y))))
(lambda (i)
(if (< i columns)
title-height
0)))))
(cols (group-to-fill-partial-sums
split
(const 1)
columns
(const 0))))
(cons title
(map (lambda (page-cols)
(apply ly:stencil-add
(index-map
(lambda (i col-stils)
(ly:stencil-translate-axis
(stack-stencils Y DOWN baseline-skip col-stils)
(* i (+ width padding))
X))
page-cols)))
cols)))))
\paper {
ragged-last-bottom = ##t
ragged-last = ##f
%% Attention : s'il y a plusieurs éléments à l'intérieur du tocActMarkup,
%% ne pas faire \new-toc-group { ... } mais \new-toc-group \line { ... }
tocActMarkup = \markup \new-toc-group \line {
\vspace #1
\hspace #-4
\italic \fromproperty #'toc:text
}
tocGhostItemMarkup = ""
tocItemMarkup = \markup
\fontsize #-2
\fill-line {
\fill-with-pattern #1.5 #CENTER .
\line {
\hspace #-6.5 %% Cancelling the first level's tocIndentMarkup
\fromproperty #'toc:indent \fromproperty #'toc:text
\hspace #2
}
\fromproperty #'toc:page
}
tocTitleMarkup =
\markup {
\column {
\vspace #3
\fill-line { \fontsize #9 "My Real Book" }
\vspace #1
\fill-line { \fontsize #3 "For C Instruments" }
\vspace #2
}
}
}
tocAct =
#(define-music-function (label text) (symbol-list-or-symbol? markup?)
(add-toc-item! 'tocActMarkup text label))
tocGhostItem =
#(define-music-function (label text) (symbol-list-or-symbol? markup?)
(add-toc-item! 'tocGhostItemMarkup text label))
\bookpart {
\paper {
left-margin = 20
right-margin = 15
}
\tocGhostItem TOC "Table of Contents"
\markuplist
% les \override sont facultatifs
\override #'(padding . 10)
\override #'(baseline-skip . 1)
\multicolumn-toc #2
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
\bookpart {
\tocItem \markup {Title}
\score {
c'1
}
}
Le dimanche 4 septembre 2022 à 22:02:18 UTC+2, Vincent Gay
<vgay@vintherine.org> a écrit :
Le 04/09/2022 à 15:07, Jean Abou Samra a écrit :
> voici une version légèrement modifiée du
> fichier toc-multicol.ly
Nickel, Merci
--
Vincent Gay
Envoyé depuis mon saxo-phone :)
https://myrealbook.vintherine.org/ - http://photos.vintherine.org/
- Re: Signets de pages pdf, Vincent Gay, 2022/09/03
- Re: Signets de pages pdf, Jean Abou Samra, 2022/09/04
- Re: Signets de pages pdf, Vincent Gay, 2022/09/04
- Re: Signets de pages pdf,
Ya Gloops <=
- Re: Signets de pages pdf, Jean Abou Samra, 2022/09/04
- Re: Signets de pages pdf, Ya Gloops, 2022/09/05
- Re: Signets de pages pdf, Ya Gloops, 2022/09/05
- Re: Signets de pages pdf, Jean Abou Samra, 2022/09/07
- Re: Signets de pages pdf, Ya Gloops, 2022/09/08