From e68931b6719a692bddc870b9879cb45c225682be Mon Sep 17 00:00:00 2001
From: Ekaitz Zarraga <ekaitz@elenq.tech>
Date: Thu, 23 Jul 2020 11:13:32 +0200
Subject: Rework on cover:

    In order to be compatible with metadata:
    - Remove text before title
    - Add text after title

    Rework the spine to let the logos stop growing if spine is thicker
    than 40mm.

    Make title fit width
---
 utils/cover/cover.scm | 70 ++++++++++++++++++++++++++++++---------------------
 1 file changed, 42 insertions(+), 28 deletions(-)

(limited to 'utils/cover')

diff --git a/utils/cover/cover.scm b/utils/cover/cover.scm
index ad29717..aa2035c 100644
--- a/utils/cover/cover.scm
+++ b/utils/cover/cover.scm
@@ -12,10 +12,11 @@
 
 ;; CONTENTS
 (define isbn "9780201379624")
-(define book-title "Qué es la informática")
-(define book-title-before "Qué es la")
-(define book-title-word "Informática")
-(define book-title-after "")
+(define book-title "Programación en Python")
+(define book-subtitle "Introducción a la programación y al lenguaje")
+(define book-title-before "") ; TODO: Thinking about removing this
+(define book-title-word  book-title)
+(define book-title-after book-subtitle)
 (define book-category "Básico")
 (define book-authors '("Giacomo Tesio" "Ekaitz Zarraga"))
 (define book-summary "
@@ -76,16 +77,17 @@ ligula. Morbi consequat fringilla mauris, vitae aliquet metus sodales in.
 
 (define text-size   (exact->inexact (/ page-height 70))); mm
 (define category-size   (* 1.5 text-size)); mm
-(define authors-size (* 2 text-size))
+(define authors-size (* 1.8 text-size))
 (define title-size   (* 2.5 text-size)); mm
 (define main-title-size ; mm
   (let ((size (exact->inexact
-               (* 2.1
+               (* 3
                   (/ page-width
                      (length (string->list book-title-word)))))))
     (if (< (/ page-height 4) size)
         (exact->inexact (/ page-height 4))
         size)))
+(define main-subtitle-size (* 2 text-size))
 
 (define width  (+ (* 2 margin) (* 2 page-width) spine-width)) ;mm
 (define height (+ (* 2 margin) page-height)) ;mm
@@ -174,25 +176,19 @@ ligula. Morbi consequat fringilla mauris, vitae aliquet metus sodales in.
   .main-title {
     font-size: "(num main-title-size)";
     font-family: 'Pathway Gothic One';
-    text-anchor: middle;
   }
   .main-title-before {
-    font-size: "(num (* 1.5 title-size))";
-    -inkscape-font-specification:'Lato Light';
-    font-family:Lato;
+    font-size: "(num (* 1 title-size))";
+    font-family: 'Pathway Gothic One';
     font-weight:300;
-    font-style:normal;
-    font-stretch:normal;
-    font-variant:normal;
   }
   .main-title-after {
-    font-size: "(num (* 1 title-size))";
-    -inkscape-font-specification:'Lato LightItalic';
+    font-size: "(num main-subtitle-size)";
+    -inkscape-font-specification:'Lato Light Italic';
+    line-height: 0.9;
+    font-style: italic;
     font-family:Lato;
-    font-weight:300;
-    font-style:italic;
-    font-stretch:normal;
-    font-variant:normal;
+    font-weight: 300;
     text-anchor: end;
   }
   .author {
@@ -357,7 +353,8 @@ ligula. Morbi consequat fringilla mauris, vitae aliquet metus sodales in.
                    (y ,(+ margin (* 0.95 page-height))))
                 "Q")
           (elenq-logo "PUBLISHING"
-                      (* spine-width 0.1 0.75)
+                      ; Max logo size is as the spine was 40mm thick
+                      (* (if (< 40 spine-width) 40 spine-width) 0.1 0.75)
                       (+ margin page-width (* 0.5 spine-width)) ;anchor is centered
                       (+ margin (* 0.95 page-height))))
 
@@ -390,25 +387,42 @@ ligula. Morbi consequat fringilla mauris, vitae aliquet metus sodales in.
                                      margin)))
               (y ,(+ margin (* 0.30 page-height))))
            ,book-title-before)
+
      (text (@ (class "main-title")
-              (x ,(exact->inexact (- width (/ page-width 2) margin)))
+              (textLength ,(* page-width 6/8))
+              (lengthAdjust ,"spacingAndGlyphs")
+              (x ,(exact->inexact (- width
+                                     (- page-width (/ page-width 8))
+                                     margin)))
               (y ,(+ main-title-size margin (* 0.30 page-height))))
            ,(string-upcase book-title-word))
 
-
-     ; TODO PENSAR SI QUITAR ESTO
      #;(text (@ (class "main-title-after")
-         (x ,(exact->inexact (- width (/ page-width 8) margin)))
-         (y ,(+ main-title-size margin (* 0.37 page-height))))
-               "Subtítulo que puede ser una frase resumen")
+              (x ,(exact->inexact (- width  (/ page-width 8) margin)))
+              (y ,(+ main-title-size
+                     (* 1.25 title-size)
+                     margin
+                     (* 0.30 page-height))))
+           ,book-title-after)
+
+     ; TODO WORK ON THIS
+     ,(textArea book-title-after
+                "main-title-after"
+                (exact->inexact (- width  (- page-width (/ page-width 8)) margin))
+                (+ main-title-size
+                   (* main-subtitle-size 0.5)
+                   margin
+                   (* 0.30 page-height))
+                (* page-width 6/8)
+                (* 2 1.25 main-subtitle-size))
 
      ,(map (lambda (author pos)
              `(text (@ (class "author")
                        (x ,(exact->inexact (- width (/ page-width 8) margin)))
                        (y ,(+ main-title-size
                               margin
-                              (* 0.37 page-height)
-                              (* pos (* 1.5 authors-size)))))
+                              (* 0.35 page-height)
+                              (* (+ 2 pos) (* 1.5 authors-size)))))
                     ,author))
            book-authors
            (iota (length book-authors)))
-- 
cgit v1.2.3