GNU bug report logs - #69424
[PATCH 0/5] Update Noto fonts and switch them to variable fonts (77% size reduced).

Previous Next

Package: guix-patches;

Reported by: Hilton Chain <hako <at> ultrarare.space>

Date: Tue, 27 Feb 2024 12:53:02 UTC

Severity: normal

Tags: patch

Done: Hilton Chain <hako <at> ultrarare.space>

Bug is archived. No further changes may be made.

Full log


Message #29 received at 69424 <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: 69424 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>, Jiwei YANG <yangjiwei <at> protonmail.com>
Subject: [PATCH v2 2/5] gnu: font-google-noto: Prefer variable fonts and split
 outputs.
Date: Wed, 28 Feb 2024 11:08:33 +0800
* gnu/packages/fonts.scm (font-google-noto)
[arguments]<#:phase>: Only install variable fonts to "out" when available.
Install hinted TTFs into "ttf" output.
[outputs]: Add "ttf".

Suggested-by: Jiwei YANG <yangjiwei <at> protonmail.com>
Change-Id: Icac2927fb6c35d08504c379e273a5fc03b08ac46
---
 gnu/packages/fonts.scm | 44 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm
index 72bf0124c4..9a268364d7 100644
--- a/gnu/packages/fonts.scm
+++ b/gnu/packages/fonts.scm
@@ -1092,6 +1092,50 @@ (define-public font-google-noto
        (sha256
         (base32 "087jg8ahpq35xwyrmvm9ivxl0wjic2j4r28bbrwqmgdva9brms40"))))
     (build-system font-build-system)
+    (arguments
+     (list
+      #:modules
+      '((guix build font-build-system)
+        (guix build utils)
+        (ice-9 ftw))
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'install
+            (lambda _
+              (define install
+                (assoc-ref %standard-phases 'install))
+              (define (scan-directory name)
+                (scandir name (lambda (file)
+                                (not (member file '("." ".." "LICENSE"))))))
+              (define (install-font-variant variant)
+                "Given font variant VARIANT, install one of its formats,
+variable TTF or OTF or TTF."
+                (with-directory-excursion variant
+                  (let ((formats (scan-directory ".")))
+                    (cond
+                     ((member "variable-ttf" formats)
+                      (with-directory-excursion "variable-ttf"
+                        (install #:outputs `(("out" . ,#$output)))))
+                     ((member "otf" formats)
+                      (with-directory-excursion "otf"
+                        (install #:outputs `(("out" . ,#$output)))))
+                     ((member "ttf" formats)
+                      (with-directory-excursion "ttf"
+                        (install #:outputs `(("out" . ,#$output)))))))))
+              (define (install-font font)
+                "Given font FONT, install one of its variants, full or unhinted,
+and install its hinted variant into 'ttf' output.
+
+unhinted and hinted variants are always available."
+                (with-directory-excursion font
+                  (if (member "full" (scan-directory "."))
+                      (install-font-variant "full")
+                      (install-font-variant "unhinted"))
+                  (with-directory-excursion "hinted"
+                    (install #:outputs `(("out" . ,#$output:ttf))))))
+              (with-directory-excursion "fonts"
+                (for-each install-font (scan-directory "."))))))))
+    (outputs '("out" "ttf"))
     (home-page "https://www.google.com/get/noto/")
     (synopsis "Fonts to cover all languages")
     (description "Google Noto Fonts is a family of fonts designed to support
-- 
2.41.0





This bug report was last modified 1 year and 62 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.