From: Saku Laesvuori via Guix-patches via <guix-patches@gnu.org>
To: 67808@debbugs.gnu.org
Cc: "Saku Laesvuori" <saku@laesvuori.fi>,
"Zhu Zihao" <all_but_last@163.com>, 宋文武 <iyzsong@envs.net>
Subject: [bug#67808] [PATCH v3 2/3] gnu: Add Nerd Font patching procedure
Date: Thu, 14 Dec 2023 16:01:13 +0200 [thread overview]
Message-ID: <f9d5a9688aac069792860f92a642949db1f77204.1702561323.git.saku@laesvuori.fi> (raw)
In-Reply-To: <173b07571f7417cc23d53e9557e7ce2871075346.1702561323.git.saku@laesvuori.fi>
* 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
next prev parent reply other threads:[~2023-12-14 14:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-13 8:00 [bug#67808] [PATCH 1/5] guix: build-system: font: Accept license-file-regexp keyword argument Saku Laesvuori via Guix-patches via
2023-12-13 8:02 ` [bug#67808] [PATCH 2/5] gnu: Add font-jetbrains-mono-nerd-font Saku Laesvuori via Guix-patches via
2023-12-13 8:02 ` [bug#67808] [PATCH 3/5] gnu: font-jetbrains-mono: Use license-file-regexp argument Saku Laesvuori via Guix-patches via
2023-12-13 8:02 ` [bug#67808] [PATCH 4/5] gnu: font-jetbrains-mono: Use the correct license Saku Laesvuori via Guix-patches via
2023-12-13 8:02 ` [bug#67808] [PATCH 5/5] gnu: font-jetbrains-mono: Update to 2.304 Saku Laesvuori via Guix-patches via
2023-12-13 14:33 ` [bug#67808] [PATCH 1/5] guix: build-system: font: Accept license-file-regexp keyword argument Simon South
2023-12-14 6:46 ` Saku Laesvuori via Guix-patches via
2023-12-14 7:35 ` [bug#67808] [PATCH v2 0/1] Add JetBrainsMono Nerd Font Saku Laesvuori via Guix-patches via
2023-12-14 7:35 ` [bug#67808] [PATCH v2 1/1] gnu: Add font-jetbrains-mono-nerd-font Saku Laesvuori via Guix-patches via
2023-12-14 14:01 ` [bug#67808] [PATCH v3 0/3] Add procedure for patching Nerd Fonts Saku Laesvuori via Guix-patches via
2023-12-14 14:01 ` [bug#67808] [PATCH v3 1/3] gnu: Add nerd-font-patcher Saku Laesvuori via Guix-patches via
2023-12-14 14:01 ` Saku Laesvuori via Guix-patches via [this message]
2023-12-14 14:01 ` [bug#67808] [PATCH v3 3/3] gnu: Add font-jetbrains-mono-nerd-font Saku Laesvuori via Guix-patches via
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f9d5a9688aac069792860f92a642949db1f77204.1702561323.git.saku@laesvuori.fi \
--to=guix-patches@gnu.org \
--cc=67808@debbugs.gnu.org \
--cc=all_but_last@163.com \
--cc=iyzsong@envs.net \
--cc=saku@laesvuori.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.