[bug#77662] gnu: font-adobe-source-han-sans: Update to 2.004.

Message ID 20250409053710.13704-1-hunt31999@gmail.com
State New
Headers
Series [bug#77662] gnu: font-adobe-source-han-sans: Update to 2.004. |

Commit Message

Kurome April 9, 2025, 5:36 a.m. UTC
  Since the OTC directory was deleted from the repo, I moved the source for
output "out" from OTC to SuperOTC.  SuperOTC is a combination of all the
weights of OTC.  The contents should not change.

* gnu/packages/fonts.scm: Import (guix build-system copy).
(font-adobe-source-han-sans): Update to 2.004.
[outputs] Add "hk" (Hong Kong).  Switch to SuperOTC for "out".
[build-system] Switch to copy-build-system for simplicity..
[arguments] Fixes for build system transition.  Use G-Expression.
[native-inputs]: Add unzip.

Change-Id: I3b37b9406c932b3e4f936367670cbd2ca4a0f926
---
 gnu/packages/fonts.scm | 60 ++++++++++++++++++++++--------------------
 1 file changed, 31 insertions(+), 29 deletions(-)
  

Comments

Christopher Baines April 11, 2025, 11:36 a.m. UTC | #1
Kurome <hunt31999@gmail.com> writes:

> Since the OTC directory was deleted from the repo, I moved the source for
> output "out" from OTC to SuperOTC.  SuperOTC is a combination of all the
> weights of OTC.  The contents should not change.
>
> * gnu/packages/fonts.scm: Import (guix build-system copy).
> (font-adobe-source-han-sans): Update to 2.004.
> [outputs] Add "hk" (Hong Kong).  Switch to SuperOTC for "out".
> [build-system] Switch to copy-build-system for simplicity..
> [arguments] Fixes for build system transition.  Use G-Expression.
> [native-inputs]: Add unzip.
>
> Change-Id: I3b37b9406c932b3e4f936367670cbd2ca4a0f926
> ---
>  gnu/packages/fonts.scm | 60 ++++++++++++++++++++++--------------------
>  1 file changed, 31 insertions(+), 29 deletions(-)

Thanks for the patch, I've pushed this to master as
70aa3b9c2fa4a8d6755fa4345210404223972628.

Chris
  

Patch

diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm
index 9d558eccbc..c3aed12bbd 100644
--- a/gnu/packages/fonts.scm
+++ b/gnu/packages/fonts.scm
@@ -93,6 +93,7 @@  (define-module (gnu packages fonts)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system meson)
   #:use-module (guix build-system trivial)
+  #:use-module (guix build-system copy)
   #:use-module (gnu packages)
   #:use-module (gnu packages c)
   #:use-module (gnu packages base)
@@ -795,46 +796,47 @@  (define-public font-terminus
 (define-public font-adobe-source-han-sans
   (package
     (name "font-adobe-source-han-sans")
-    (version "1.004")
+    (version "2.004")
     (source (origin
               (method git-fetch)
               (uri (git-reference
-                     (url "https://github.com/adobe-fonts/source-han-sans")
-                     (commit (string-append version "R"))))
+                    (url "https://github.com/adobe-fonts/source-han-sans")
+                    (commit (string-append version "R"))))
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0zm884d8fp5gvirq324050kqv7am9khyqhs9kk4r4rr3jzn61jpk"))))
-    (outputs '("out"                 ; OpenType/CFF Collection (OTC), 121 MiB.
-               "cn" "jp" "kr" "tw")) ; Region-specific Subset OpenType/CFF.
-    (build-system trivial-build-system)
+                "0sgfvdigq9vdmf8wizapy8wcyzqrqj8il9sx1xzfm20qy376qvbf"))))
+    (outputs '("out"                   ; OpenType/CFF Collection (OTC), 112 MiB.
+               "cn" "hk" "jp" "kr" "tw")) ; Region-specific Subset OpenType/CFF.
+    (build-system copy-build-system)
     (arguments
-     `(#:modules ((guix build utils))
-       #:builder
-       (begin
-         (use-modules (guix build utils))
-         (let ((install-opentype-fonts
-                (lambda (fonts-dir out)
-                  (copy-recursively fonts-dir
-                                    (string-append (assoc-ref %outputs out)
-                                                   "/share/fonts/opentype")))))
-           (chdir (assoc-ref %build-inputs "source"))
-           (install-opentype-fonts "OTC" "out")
-           (install-opentype-fonts "SubsetOTF/CN" "cn")
-           (install-opentype-fonts "SubsetOTF/JP" "jp")
-           (install-opentype-fonts "SubsetOTF/KR" "kr")
-           (install-opentype-fonts "SubsetOTF/TW" "tw")
-           (for-each delete-file (find-files %output "\\.zip$"))
-           #t))))
+     (list
+      #:install-plan
+      #~'(("SubsetOTF/CN" "share/fonts/opentype" #:output "cn")
+          ("SubsetOTF/HK" "share/fonts/opentype" #:output "hk")
+          ("SubsetOTF/JP" "share/fonts/opentype" #:output "jp")
+          ("SubsetOTF/KR" "share/fonts/opentype" #:output "kr")
+          ("SubsetOTF/TW" "share/fonts/opentype" #:output "tw"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'install 'install-otc
+            (lambda _
+              (let ((destination-directory
+                     (string-append #$output "/share/fonts/opentype")))
+                (mkdir-p destination-directory)
+                (invoke "unzip" "SuperOTC/SourceHanSans.ttc.zip"
+                        "-d" destination-directory)))))))
+    (native-inputs (list unzip))
     (home-page "https://github.com/adobe-fonts/source-han-sans")
     (synopsis "Pan-CJK fonts")
     (description
      "Source Han Sans is a sans serif Pan-CJK font family that is offered in
-seven weights: ExtraLight, Light, Normal, Regular, Medium, Bold, and Heavy.
-And in several OpenType/CFF-based deployment configurations to accommodate
-various system requirements or limitations.  As the name suggests, Pan-CJK
-fonts are intended to support the characters necessary to render or display
-text in Simplified Chinese, Traditional Chinese, Japanese, and Korean.")
+seven weights: ExtraLight, Light, Normal, Regular, Medium, Bold, and Heavy.  And
+in several OpenType/CFF-based deployment configurations to accommodate various
+system requirements or limitations.  As the name suggests, Pan-CJK fonts are
+intended to support the characters necessary to render or display text in
+Simplified Chinese, Traditional Chinese (Taiwan, Hong Kong), Japanese, and
+Korean.")
     (license license:silofl1.1)))
 
 (define-public font-cns11643