[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 'mm' scaling value on top-level
From: |
Werner LEMBERG |
Subject: |
Re: 'mm' scaling value on top-level |
Date: |
Wed, 29 Sep 2021 10:43:27 +0000 (UTC) |
>> OK, thanks for the pointer. But I wonder what exactly the problem
>> is: The paper size strings passed to `set-default-paper-size` *do*
>> contain the 'mm' variable, see `paper-alist`. Is the expansion of
>> 'mm' delayed? Isn't there a possibility to do the same on the top
>> level?
>
> You could probably pass the values in a similar quoted style that
> then gets eval'ed within the paper context where the measurements
> are defined:
>
> %%%%
> #(set-default-paper-size '(cons (* 55 mm) (* 89 mm)))
> %%%%
>
> [...]
Thanks. Attached is my next iteration. This is almost what I want,
however, I'm sure it's wrong in the details. Reason: It accepts
#(set-default-paper-size '(cons 100 50))
(at the top level) but dislikes
#(set-default-paper-size '(100 . 50))
How can I fix this? Again, any pointers are much appreciated.
Werner
diff --git a/scm/paper.scm b/scm/paper.scm
index 5b44843562..13cc631da2 100644
--- a/scm/paper.scm
+++ b/scm/paper.scm
@@ -244,9 +244,14 @@
(define (lookup-paper-name module name landscape?)
"Look up @var{name} and return a number pair of width and height,
where @var{landscape?} specifies whether the dimensions should be swapped
-unless explicitly overridden in the name."
+unless explicitly overridden in the name.
+
+If @var{name} is a quoted pair of numbers, use the values directly,
+ignoring @var{landscape?}."
(let* ((swapped?
- (cond ((string-suffix? "landscape" name)
+ (cond ((pair? name)
+ #f)
+ ((string-suffix? "landscape" name)
(set! name
(string-trim-right (string-drop-right name 9)))
#t)
@@ -257,7 +262,9 @@ unless explicitly overridden in the name."
(else landscape?)))
(is-paper? (module-defined? module 'is-paper))
(entry (and is-paper?
- (eval-carefully (assoc-get name paper-alist)
+ (eval-carefully (if (pair? name)
+ name
+ (assoc-get name paper-alist))
module
#f))))
(and entry is-paper?