summaryrefslogtreecommitdiff
path: root/utils/cover
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2020-03-12 17:49:15 +0100
committerEkaitz Zarraga <ekaitz@elenq.tech>2020-03-12 17:49:15 +0100
commit8ad38bebe2d6563f6824eedba774d78cb4791837 (patch)
treed71496398980e983d82d80798dd9680c6b801eff /utils/cover
parent4d931905658b55f96a92cd061751cdcb3bf73838 (diff)
Handle thin Spines
Diffstat (limited to 'utils/cover')
-rw-r--r--utils/cover/cover.scm30
1 files changed, 23 insertions, 7 deletions
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 ;;