lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Displaying typesetting information at compile time


From: Richard Shann
Subject: Re: Displaying typesetting information at compile time
Date: Sun, 20 Mar 2022 18:09:08 +0000
User-agent: Evolution 3.38.3-1

On Sun, 2022-03-20 at 18:43 +0100, Jean Abou Samra wrote:
> 
> \version "2.22.2"
> 
> markWithPageInfo =
>    %% Must not get called before line breaking
>    \tweak X-extent #'(0 . 0)
>    \tweak Y-extent #'(0 . 0)
>    \tweak horizontal-skylines
>      #(ly:make-unpure-pure-container ly:grob::simple-horizontal-
> skylines-from-extents)
>    \tweak vertical-skylines
>      #(ly:make-unpure-pure-container ly:grob::simple-vertical-
> skylines-from-extents)
>    \tweak stencil
>      #(lambda (grob)
>         (let* ((sys (ly:grob-system grob))
>                ;; No broken pieces for systems ...
>                (alignment (ly:grob-object sys 'vertical-alignment))
>                (all-alignments (ly:spanner-broken-into (ly:grob-
> original alignment)))
>                (all-systems (map ly:grob-system all-alignments))
>                (n-systems (length all-systems))
>                (all-pages (map (lambda (s) (ly:grob-property s 'page-
> number))
>                                all-systems))
>                (n-pages (1+ (- (apply max all-pages)
>                                (apply min all-pages))))
>                (layout (ly:grob-layout grob))
>                (defs (append `((n-systems . ,(number->string n-
> systems))
>                                (n-pages . ,(number->string n-pages)))
>                              (ly:output-def-lookup layout 'text-font-
> defaults)))
>                (props (ly:grob-alist-chain grob defs))
>                (text (ly:grob-property grob 'text)))
>           (interpret-markup layout props text)))
>    \mark \etc
> 
> {
>    \markWithPageInfo \markup { Have \fromproperty #'n-systems systems
> on \fromproperty #'n-pages pages }
>    \repeat unfold 20 { 1 1 \break }
> }

Wow! That goes beyond what I had in mind - it actually outputs the
information within the typeset (I guess the stuff with skylining might
be to avoid the typesetting of this information affecting the number of
pages/systems??). What I had in mind was just some Scheme (display ...)
inserted in the way Valentin (*) did with this:

\override Score.SpacingSpanner.common-shortest-duration =
#(grob-transformer 'common-shortest-duration
                   (lambda (grob orig) (display orig) (newline) orig))

So that the information can be used to guide selection of tweaks.

Richard

(*) in the "Re: Wildly different horizontal spacing in two similar
scores." thread







reply via email to

[Prev in Thread] Current Thread [Next in Thread]