From 8ad38bebe2d6563f6824eedba774d78cb4791837 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Thu, 12 Mar 2020 17:49:15 +0100 Subject: Handle thin Spines --- utils/cover/cover.scm | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'utils/cover/cover.scm') diff --git a/utils/cover/cover.scm b/utils/cover/cover.scm index 24887f9..3af66ff 100644 --- a/utils/cover/cover.scm +++ b/utils/cover/cover.scm @@ -60,7 +60,7 @@ ligula. Morbi consequat fringilla mauris, vitae aliquet metus sodales in. ; SIZE ; Take spine from the outside because it's related to the amount of pages -(define spine-width 20) ;mm +(define spine-width 5) ;mm (define spine-title-margin-min (* 0.1 spine-width)) (define spine-title-max-size 10) (define spine-title-size @@ -97,9 +97,16 @@ ligula. Morbi consequat fringilla mauris, vitae aliquet metus sodales in. ; world ones, in this case millimeters ; Read more: https://mpetroff.net/2013/08/analysis-of-svg-units/ -(define (elenq-logo sub size x y) ; 10 x 4mm +(define (elenq-logo sub size x y . extra) ; 10 x 4mm `(g (@ (id "elenq-logo") - (transform ,(string-append "translate(" (num x) "," (num y) ")" "scale(" (num size) ")"))) + (transform + ,(string-append + "translate(" (num x) "," (num y) ")" + "scale(" (num size) ")" + (if (< 0 (length extra)) + (string-append "rotate (" (num (first extra)) ")") + "") + ))) (g (@ (transform "scale(0.1667)")) (text (@ (x 0) (y 0) @@ -339,10 +346,19 @@ ligula. Morbi consequat fringilla mauris, vitae aliquet metus sodales in. (height ,spine-title-size)) ,(string-join book-authors ", ")))) - ,(elenq-logo "PUBLISHING" - (* spine-width 0.1 0.75) - (+ margin page-width (* 0.5 spine-width)) - (+ margin (* 0.95 page-height))) + + ,(if (< spine-width 10) + ; Smaller than 10mm -> Renders just a Q + `(text (@ (style ,(string-append "font-family: armata; + text-anchor: middle; + font-size: " (num spine-width))) + (x ,(+ margin page-width (* 0.5 spine-width))) + (y ,(+ margin (* 0.95 page-height)))) + "Q") + (elenq-logo "PUBLISHING" + (* spine-width 0.1 0.75) + (+ margin page-width (* 0.5 spine-width)) ;anchor is centered + (+ margin (* 0.95 page-height)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; FRONT SIDE ;; -- cgit v1.2.3