-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am Sonntag, 5. Oktober 2008 schrieb Graham Percival:
> On Sun, 5 Oct 2008 16:57:52 +0100
>
> "Neil Puttock" <[EMAIL PROTECTED]> wrote:
> > 2008/10/5 Graham Percival <[EMAIL PROTECTED]>:
> > > Two more updates to margins-a4-letter.ly:
> > > - if you specify #(set-default-paper-size "letter"), it doesn't
> > >  work.  You need to do it with #(ly:set-option...)
> > > instructions are in the file.
> >
> > This is easily fixed,
>
> How?  The problem is here:
> #(define is-letter? (string=? (ly:get-option 'paper-size) "letter"))
> but I couldn't figure out how to rewrite is-letter? to avoid using
> ly:get-option.
>
> In other words, does
> #(set-default-paper-size ...)
> set any variables other than paper-width and paper-height?  ie is
> there a paper-size variable?  I couldn't see any in the definition
> of set-default-paper-size in scm/paper.scm.  I'd love to fix this, but
> I can't see how.

Yes, it does. internal-set-paper-size sets the symbol 'papersizename in the 
default paper module to the name. You can easily extract it in scheme:

  #(let* ((paper (ly:output-def-scope (eval '$defaultpaper (current-module))))
         (size (eval 'papersizename paper)))
  (ly:message "The current default paper size is: ~a" size))

To extract the paper name if set using #(set-paper-size name) inside a \book, 
you just have to check if the current module is a paper in in that case use 
the current-module instead of the defaultpaper...

I've attached a sample file illustrating this.

Cheers,
Reinhold

- -- 
- ------------------------------------------------------------------
Reinhold Kainhofer, Vienna University of Technology, Austria
email: [EMAIL PROTECTED], http://reinhold.kainhofer.com/
 * Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at/
 * K Desktop Environment, http://www.kde.org, KOrganizer maintainer
 * Chorvereinigung "Jung-Wien", http://www.jung-wien.at/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFI6QWYTqjEwhXvPN0RArefAKCqyrvDXkZyVc/XzzosHAzGw/QjdACgg9NG
HL1oJyWj7Re/GJ/PIG3CINM=
=pbsp
-----END PGP SIGNATURE-----
\version "2.11.61"

#(set-default-paper-size "a4")

#(define-public (printpapersize)
  (let* ((inside-paper? (module-defined? (current-module) 'is-paper))
         (default-paper (ly:output-def-scope (eval '$defaultpaper (current-module))))         
         (paper (if inside-paper? (current-module) default-paper))
         (size (eval 'papersizename paper)))
  (ly:message "The current paper size is: \"~a\" (inside paper ~a)" size inside-paper?)))

#(set-default-paper-size "letter")
#(printpapersize)
  
#(set-default-paper-size "a4")
#(printpapersize)

#(set-default-paper-size "a3")
#(printpapersize)

\book{
  \relative c' {c1} 
  \paper {
    #(set-paper-size "a2")
    #(printpapersize)
  }
}

% The papersize is reset to a3!
#(printpapersize)
_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to