Get the paper size in scheme

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Get the paper size in scheme

Robert Kubosz
Hi everyone!

I am currently creating a template for a book. I want to create a scheme
function, which adapts markup according to paper size. The problem is,
that I don't know how to get current paper size.

AFAIK there is #(set-default-paper-size "paper-size") and I could not
find a variable holding the paper size.

I want to ask you where to find the paper size or how to overpass this
problem?


Robert


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user

kubosz_robert.vcf (156 bytes) Download Attachment
dak
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Get the paper size in scheme

dak
Robert Kubosz <[hidden email]> writes:

> Hi everyone!
>
> I am currently creating a template for a book. I want to create a scheme
> function, which adapts markup according to paper size. The problem is,
> that I don't know how to get current paper size.

Markup commands get a "layout" argument.

You can then access the paper-width variable inside.  Dimensions are in
units depending on staff spaces, so you usually want to adjust for
that.  Which is reasonably easy, given that units are also expressed in
staff spaces.  There may be rounding errors due to that.


#(define-markup-command (print-width layout props unit) (symbol?)
  (interpret-markup layout props
   (format #f "~f ~s" (/ (ly:output-def-lookup layout 'paper-width)
                      (ly:output-def-lookup layout unit)) unit)))

\markup { "Paperwidth is" \print-width #'cm "." }



--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Loading...