Use the scale when rendering svg
Thanks to Antonio Menezes Leitao for the change original commit: 046a851d7090f35a5966a3020e29d40c59948567
This commit is contained in:
parent
81698b177c
commit
990dc34ae3
|
@ -1237,6 +1237,19 @@
|
||||||
[svg? (regexp-match? #rx#"[.]svg$" (if (path? src) (path->bytes src) src))]
|
[svg? (regexp-match? #rx#"[.]svg$" (if (path? src) (path->bytes src) src))]
|
||||||
[sz (cond
|
[sz (cond
|
||||||
[svg?
|
[svg?
|
||||||
|
(define (to-scaled-num-from-str s)
|
||||||
|
(define parts
|
||||||
|
(regexp-match
|
||||||
|
#rx"^([+-]?[0-9]*\\.?([0-9]+)?)(em|ex|px|in|cm|mm|pt|pc|%|)$"
|
||||||
|
s))
|
||||||
|
(cond
|
||||||
|
[parts
|
||||||
|
(string-append
|
||||||
|
(number->string
|
||||||
|
(* scale
|
||||||
|
(string->number (list-ref parts 1))))
|
||||||
|
(list-ref parts 3))]
|
||||||
|
[else s]))
|
||||||
(call-with-input-file*
|
(call-with-input-file*
|
||||||
src
|
src
|
||||||
(lambda (in)
|
(lambda (in)
|
||||||
|
@ -1257,7 +1270,8 @@
|
||||||
[w (ormap (check-name 'width) attribs)]
|
[w (ormap (check-name 'width) attribs)]
|
||||||
[h (ormap (check-name 'height) attribs)])
|
[h (ormap (check-name 'height) attribs)])
|
||||||
(if (and w h)
|
(if (and w h)
|
||||||
`([width ,w][height ,h])
|
`([width ,(to-scaled-num-from-str w)]
|
||||||
|
[height ,(to-scaled-num-from-str h)])
|
||||||
null)))))]
|
null)))))]
|
||||||
[else
|
[else
|
||||||
;; Try to extract file size:
|
;; Try to extract file size:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user