[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#67808] [PATCH v3 2/3] gnu: Add Nerd Font patching procedure
From: |
Saku Laesvuori |
Subject: |
[bug#67808] [PATCH v3 2/3] gnu: Add Nerd Font patching procedure |
Date: |
Thu, 14 Dec 2023 16:01:13 +0200 |
* gnu/packages/fonts.scm (patch-nerd-font): New variable.
Change-Id: Id830424ec68836df7622535207818ff3445c21d4
---
gnu/packages/fonts.scm | 54 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm
index 813367be8a..3568f38c60 100644
--- a/gnu/packages/fonts.scm
+++ b/gnu/packages/fonts.scm
@@ -59,6 +59,7 @@
;;; Copyright © 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
;;; Copyright © 2023 chris <chris@bumblehead.com>
;;; Copyright © 2023 Luis Felipe López Acevedo <sirgazil@zoho.com>
+;;; Copyright © 2023 Saku Laesvuori <saku@laesvuori.fi>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -103,6 +104,56 @@ (define-module (gnu packages fonts)
#:use-module (gnu packages sdl)
#:use-module (gnu packages xorg))
+(define-public (patch-nerd-font font-package)
+ "Return a package that contains the same files as FONT-PACKAGE, except
+that all font files are Nerd Fonts patched."
+ (package
+ (name (string-append (package-name font-package) "-nerd-font"))
+ (version (package-version font-package))
+ (source #f)
+ (build-system trivial-build-system)
+ (arguments
+ (list
+ #:builder
+ (with-imported-modules '((guix build utils))
+ #~(begin
+ (use-modules (guix build utils))
+
+ (define (font-file? filename)
+ ;; The regexp's are from guix/build/font-build-system.scm
(install)
+ ;; woff2 is excluded because the fontforge in guix is not
compiled
+ ;; with support for it
+ ((file-name-predicate "\\.(tt[fc]|ot[fc]|woff)$")
+ filename #f)) ;the 2. argument is stat but it is unused
+
+ (define (output-path source-path)
+ (let* ((name-version/path (strip-store-file-name source-path))
+ (path-pieces (string-split name-version/path
+ file-name-separator?))
+ (path-in-package (string-join (cdr path-pieces)
+ file-name-separator-string
+ 'prefix)))
+ (string-append #$output (dirname path-in-package))))
+
+ (define (install-and-patch-file file)
+ (if (font-file? file)
+ (invoke (string-append #$(this-package-native-input
"nerd-font-patcher")
+ "/bin/font-patcher")
+ file "-o" (output-path file) "--complete")
+ (install-file file (output-path file))))
+
+ (for-each install-and-patch-file
+ (find-files #$(this-package-native-input
+ (package-name font-package))))))))
+ (native-inputs (list nerd-font-patcher font-package))
+ (synopsis
+ (string-append (package-synopsis font-package) " (Nerd Fonts patched)"))
+ (description
+ (string-append (package-description font-package)
+ " Nerd Fonts patching adds thousands of symbolic glyphs."))
+ (home-page (package-home-page font-package))
+ (license (package-license font-package))))
+
(define-public font-artifika
(package
(name "font-artifika")
@@ -2526,6 +2577,9 @@ (define-public font-jetbrains-mono
in small sizes, the text looks crisper.")
(license license:asl2.0)))
+(define-public font-jetbrains-mono-nerd-font
+ (patch-nerd-font font-jetbrains-mono))
+
(define-public font-juliamono
(package
(name "font-juliamono")
--
2.41.0
- [bug#67808] [PATCH 2/5] gnu: Add font-jetbrains-mono-nerd-font, (continued)
- [bug#67808] [PATCH 2/5] gnu: Add font-jetbrains-mono-nerd-font, Saku Laesvuori, 2023/12/13
- [bug#67808] [PATCH 4/5] gnu: font-jetbrains-mono: Use the correct license., Saku Laesvuori, 2023/12/13
- [bug#67808] [PATCH 3/5] gnu: font-jetbrains-mono: Use license-file-regexp argument, Saku Laesvuori, 2023/12/13
- [bug#67808] [PATCH 5/5] gnu: font-jetbrains-mono: Update to 2.304, Saku Laesvuori, 2023/12/13
- [bug#67808] [PATCH 1/5] guix: build-system: font: Accept license-file-regexp keyword argument, Simon South, 2023/12/13
- [bug#67808] [PATCH v2 0/1] Add JetBrainsMono Nerd Font, Saku Laesvuori, 2023/12/14
- [bug#67808] [PATCH v3 0/3] Add procedure for patching Nerd Fonts, Saku Laesvuori, 2023/12/14
- [bug#67808] [PATCH v3 1/3] gnu: Add nerd-font-patcher, Saku Laesvuori, 2023/12/14