From patchwork Thu Dec 14 14:01:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Saku Laesvuori X-Patchwork-Id: 57603 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 7B15827BBEA; Thu, 14 Dec 2023 14:03:31 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id B5AD827BBE2 for ; Thu, 14 Dec 2023 14:03:30 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rDmIs-0001E3-Rt; Thu, 14 Dec 2023 09:03:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rDmIr-0001Dd-BI for guix-patches@gnu.org; Thu, 14 Dec 2023 09:03:05 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rDmIp-0006eE-Ia for guix-patches@gnu.org; Thu, 14 Dec 2023 09:03:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rDmIo-0004cN-Fk; Thu, 14 Dec 2023 09:03:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67808] [PATCH v3 2/3] gnu: Add Nerd Font patching procedure Resent-From: Saku Laesvuori Original-Sender: "Debbugs-submit" Resent-CC: all_but_last@163.com, iyzsong@envs.net, guix-patches@gnu.org Resent-Date: Thu, 14 Dec 2023 14:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67808 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 67808@debbugs.gnu.org Cc: Saku Laesvuori , Zhu Zihao , =?utf-8?b?5a6L5paH5q2m?= X-Debbugs-Original-Xcc: Zhu Zihao , =?utf-8?b?5a6L5paH?= =?utf-8?b?5q2m?= Received: via spool by 67808-submit@debbugs.gnu.org id=B67808.170256253217671 (code B ref 67808); Thu, 14 Dec 2023 14:03:02 +0000 Received: (at 67808) by debbugs.gnu.org; 14 Dec 2023 14:02:12 +0000 Received: from localhost ([127.0.0.1]:49031 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rDmI0-0004ax-BJ for submit@debbugs.gnu.org; Thu, 14 Dec 2023 09:02:12 -0500 Received: from vmi571514.contaboserver.net ([75.119.130.101]:50762 helo=mail.laesvuori.fi) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rDmHx-0004ao-CD for 67808@debbugs.gnu.org; Thu, 14 Dec 2023 09:02:11 -0500 Received: from X-kone.org.aalto.fi (unknown [130.233.144.30]) by mail.laesvuori.fi (Postfix) with ESMTPSA id 19B66343635; Thu, 14 Dec 2023 15:02:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=laesvuori.fi; s=mail; t=1702562534; bh=TRlLAWASiH0hmPGYysqsVdkCugcgC2d/wXrDFiO25bk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mZo4UB8Btsv2G3n8046qVzxVPNmBe0WvKUN8Ve+4OMPCqySmS1vpCN469KBnO8T0l DgBVXsK7tEcMF7tG5nz1D5xNofLwWzlsUgO0e18tCa32RqHEqB58S1MdbC/5zty2O7 Qbccb4AfxJLgmhgJmzV0Nk3LCnFl0bsKs6bn0Mjo= Date: Thu, 14 Dec 2023 16:01:13 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: <173b07571f7417cc23d53e9557e7ce2871075346.1702561323.git.saku@laesvuori.fi> References: <173b07571f7417cc23d53e9557e7ce2871075346.1702561323.git.saku@laesvuori.fi> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Saku Laesvuori X-ACL-Warn: , Saku Laesvuori via Guix-patches X-Patchwork-Original-From: Saku Laesvuori via Guix-patches via From: Saku Laesvuori Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * 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 ;;; Copyright © 2023 chris ;;; Copyright © 2023 Luis Felipe López Acevedo +;;; Copyright © 2023 Saku Laesvuori ;;; ;;; 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")