Subject: [PATCH] gnu: Add font-iosevka-ssNN variants.
From: Tobias Geerinckx-Rice <[email-masked]>
To: [email-masked]
Cc: Tobias Geerinckx-Rice <[email-masked]>
Date: Fri, 29 Mar 2019 22:05:15 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

From: Tobias Geerinckx-Rice <[email-masked]>

* gnu/packages/fonts.scm (font-iosevka, ttc-iosevka-slab): Use new
FONT-IOSEVKA-VARIANT procedure.
(font-iosevka-ss01, font-iosevka-ss02, font-iosevka-ss03)
(font-iosevka-ss04, font-iosevka-ss05, font-iosevka-ss06)
(font-iosevka-ss07, font-iosevka-ss08, font-iosevka-ss09)
(font-iosevka-ss10, font-iosevka-ss11): New public variables.
---

Guix,

People who install such fonts likely care about things like this[0].  I do.

Questions marked with ‘XXX’ in-line.

Kind regards,

T G-R

[0]: https://raw.githubusercontent.com/be5invis/Iosevka/master/images/stylesets.png

 gnu/packages/fonts.scm | 119 +++++++++++++++++++++++++++++++++--------
 1 file changed, 97 insertions(+), 22 deletions(-)

diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm
index 569a7f807e..945b321170 100644
--- a/gnu/packages/fonts.scm
+++ b/gnu/packages/fonts.scm
@@ -1083,41 +1083,116 @@ later hand-tweaked with the gbdfed(1) editor:
 typeface, by mimicking Comic Sans while fixing its most obvious shortcomings.")
     (license license:silofl1.1)))
 
-(define-public font-iosevka
+(define* (font-iosevka-variant name archive-prefix
+                               #:key sha256 synopsis)
   (package
-    (name "font-iosevka")
+    (name name)
     (version "2.2.0")
     (source
      (origin
        (method url-fetch/zipbomb)
-       (uri (string-append "https://github.com/be5invis/Iosevka"
-                           "/releases/download/v" version
-                           "/ttc-iosevka-" version ".zip"))
-       (sha256
-        (base32 "14jfv6pkh1w44m89z2fn44kgmmqaf0057lk71advwfbm3q313y0x"))))
+       (uri (string-append "https://github.com/be5invis/Iosevka/"
+                           "releases/download/v" version "/"
+                           archive-prefix "-" version ".zip"))
+       (sha256 sha256)))
     (build-system font-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'install 'maybe-change-directory
+           ;; The SS-* variants ship the TTF fonts in a ‘ttf/’ subdirectory
+           ;; alongside other formats, the others don't.
+           ;; XXX Install these other formats (e.g. WOFF2) too?
+           (lambda _
+             (when (file-exists? "ttf")
+               (chdir "ttf"))
+             #t)))))
     (home-page "https://be5invis.github.io/Iosevka/")
-    (synopsis "Coders' typeface, built from code")
+    (synopsis synopsis)            ; XXX does this do the right i18n thing?
     (description
      "Iosevka is a slender monospace sans-serif or slab-serif typeface inspired
 by Pragmata Pro, M+, and PF DIN Mono, designed to be the ideal font for
 programming.  Iosevka is completely generated from its source code.")
-    (license (list license:silofl1.1 ; build artifacts (i.e. the fonts)
-                   license:bsd-3)))) ; supporting code
+    (license (list license:silofl1.1    ; build artifacts (i.e. the fonts)
+                   license:bsd-3))))    ; supporting code
+
+(define-public font-iosevka
+  (font-iosevka-variant
+   "font-iosevka" "ttc-iosevka"
+   #:sha256 (base32 "14jfv6pkh1w44m89z2fn44kgmmqaf0057lk71advwfbm3q313y0x")
+   #:synopsis "Coders' typeface, built from code (sans-serif variant)"))
 
 (define-public font-iosevka-slab
-  (package
-    (inherit font-iosevka)
-    (name "font-iosevka-slab")
-    (version (package-version font-iosevka))
-    (source
-     (origin
-       (method url-fetch/zipbomb)
-       (uri (string-append "https://github.com/be5invis/Iosevka"
-                           "/releases/download/v" version
-                           "/ttc-iosevka-slab-" version ".zip"))
-       (sha256
-        (base32 "186d0pl13znysll3hvzm1ixn7ad616g6dhla55sbh6ki2j04b8ml"))))))
+  (font-iosevka-variant
+   "font-iosevka-slab" "ttc-iosevka-slab"
+   #:sha256 (base32 "186d0pl13znysll3hvzm1ixn7ad616g6dhla55sbh6ki2j04b8ml")
+   #:synopsis "Coders' typeface, built from code (slab-serif variant)"))
+
+(define-public font-iosevka-ss01
+  (font-iosevka-variant
+   "font-iosevka-ss01" "iosevka-ss01"
+   #:sha256 (base32 "0ax5fcc8s6kcfd8ds67pn9h89ddjm0fpa2fs5dqn0aqx56v3047j")
+   #:synopsis "Coders' typeface, built from code (sans-serif SS01 variant)"))
+
+(define-public font-iosevka-ss02
+  (font-iosevka-variant
+   "font-iosevka-ss02" "iosevka-ss02"
+   #:sha256 (base32 "09sny0alsgzb9diz8illnvvqbqa9yhhyjk9a2awbppddbh91k2qs")
+   #:synopsis "Coders' typeface, built from code (sans-serif SS02 variant)"))
+
+(define-public font-iosevka-ss03
+  (font-iosevka-variant
+   "font-iosevka-ss03" "iosevka-ss03"
+   #:sha256 (base32 "1gnf01bima08siphnhgg7kygmks0p717j1fdq07fkigsi2g0fbay")
+   #:synopsis "Coders' typeface, built from code (sans-serif SS03 variant)"))
+
+(define-public font-iosevka-ss04
+  (font-iosevka-variant
+   "font-iosevka-ss04" "iosevka-ss04"
+   #:sha256 (base32 "1gkdz843c5qsrl1k8j5ib9gpkkrcf5hkd5rghfq1ivi1a7rvjs4r")
+   #:synopsis "Coders' typeface, built from code (sans-serif SS04 variant)"))
+
+(define-public font-iosevka-ss05
+  (font-iosevka-variant
+   "font-iosevka-ss05" "iosevka-ss05"
+   #:sha256 (base32 "10n1zmpnp8s1bxyr1yv14nvmf1g91hdsl1c4j3y9d94kcpsvqbwi")
+   #:synopsis "Coders' typeface, built from code (sans-serif SS05 variant)"))
+
+(define-public font-iosevka-ss06
+  (font-iosevka-variant
+   "font-iosevka-ss06" "iosevka-ss06"
+   #:sha256 (base32 "12d4gidmp1ldnlmdzp7x6d7b2jxyykf6y53h5x3hh8acz5q9172n")
+   #:synopsis "Coders' typeface, built from code (sans-serif SS06 variant)"))
+
+(define-public font-iosevka-ss07
+  (font-iosevka-variant
+   "font-iosevka-ss07" "iosevka-ss07"
+   #:sha256 (base32 "19lppgmwgjh7ykyvlhjbf26yfnpiy3wa6l358kvx0w8xrgrm6fz9")
+   #:synopsis "Coders' typeface, built from code (sans-serif SS07 variant)"))
+
+(define-public font-iosevka-ss08
+  (font-iosevka-variant
+   "font-iosevka-ss08" "iosevka-ss08"
+   #:sha256 (base32 "0bc50z01ywh5y5y24xmiwqbw10vp5hjlrg7y8nmqjxg04222q6vi")
+   #:synopsis "Coders' typeface, built from code (sans-serif SS08 variant)"))
+
+(define-public font-iosevka-ss09
+  (font-iosevka-variant
+   "font-iosevka-ss09" "iosevka-ss09"
+   #:sha256 (base32 "082bfnmc73wf84c9z0kpamf857j6ibcfg141vs15fjkairvwk1jb")
+   #:synopsis "Coders' typeface, built from code (sans-serif SS09 variant)"))
+
+(define-public font-iosevka-ss10
+  (font-iosevka-variant
+   "font-iosevka-ss10" "iosevka-ss10"
+   #:sha256 (base32 "0vy76r1bph1nh43dvkdi0wgf1fgq5qwmnmcxrjfkilmx0jzpmmkg")
+   #:synopsis "Coders' typeface, built from code (sans-serif SS10 variant)"))
+
+(define-public font-iosevka-ss11
+  (font-iosevka-variant
+   "font-iosevka-ss11" "iosevka-ss11"
+   #:sha256 (base32 "1skgn1z14rk5xvnzvnk8i4s90hrxcxnmchhasbp8jg6cmqwpp177")
+   #:synopsis "Coders' typeface, built from code (sans-serif SS11 variant)"))
 
 (define-public font-go
   (let ((commit "f03a046406d4d7fbfd4ed29f554da8f6114049fc")
-- 
2.21.0