[PATCH 1/5] guix: build-system: font: Accept license-file-regexp keyword argument

  • Open
  • quality assurance status badge
Details
2 participants
  • Saku Laesvuori
  • Simon South
Owner
unassigned
Submitted by
Saku Laesvuori
Severity
normal
S
S
Saku Laesvuori wrote on 13 Dec 2023 09:00
(address . guix-patches@gnu.org)(name . Saku Laesvuori)(address . saku@laesvuori.fi)
123127b6a5bf1c94ff62b0779837a6e54975c81f.1702454367.git.saku@laesvuori.fi
* guix/build-system/font.scm: (font-build): Pass license-file-regexp
keyword argument to font-build.
* guix/build-system/gnu.scm: Export %license-file-regexp.

Change-Id: I4e9378cbed9a8c3b9838efcd448e9bfec8ba97be
---
guix/build-system/font.scm | 2 ++
guix/build-system/gnu.scm | 1 +
2 files changed, 3 insertions(+)

Toggle diff (36 lines)
diff --git a/guix/build-system/font.scm b/guix/build-system/font.scm
index c57c304f52..893e9f635e 100644
--- a/guix/build-system/font.scm
+++ b/guix/build-system/font.scm
@@ -81,6 +81,7 @@ (define* (font-build name inputs
(search-paths '())
(system (%current-system))
(guile #f)
+ (license-file-regexp %license-file-regexp)
(imported-modules %font-build-system-modules)
(modules '((guix build font-build-system)
(guix build utils))))
@@ -94,6 +95,7 @@ (define* (font-build name inputs
#~(font-build #:name #$name
#:source #+source
#:configure-flags #$configure-flags
+ #:license-file-regexp #$license-file-regexp
#:system #$system
#:test-target #$test-target
#:tests? #$tests?
diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm
index cdbb547773..b8082354b9 100644
--- a/guix/build-system/gnu.scm
+++ b/guix/build-system/gnu.scm
@@ -28,6 +28,7 @@ (define-module (guix build-system gnu)
#:use-module (srfi srfi-1)
#:use-module (ice-9 match)
#:export (%gnu-build-system-modules
+ %license-file-regexp
%strip-flags
%strip-directories
gnu-build

base-commit: 4bf4e340b74b66a0fc319aeb100fb1f948a67211
--
2.41.0
S
S
Saku Laesvuori wrote on 13 Dec 2023 09:02
[PATCH 2/5] gnu: Add font-jetbrains-mono-nerd-font
(address . 67808@debbugs.gnu.org)(name . Saku Laesvuori)(address . saku@laesvuori.fi)
7be7f388a88ecf4ce0e0bbad26398b4c8637345f.1702454367.git.saku@laesvuori.fi
* gnu/packages/fonts.scm (font-jetbrains-mono-nerd-font): New variable.

Change-Id: I52e3e3fda5fa83b6b0e865b9e56f008f91a4465c
---
gnu/packages/fonts.scm | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)

Toggle diff (44 lines)
diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm
index 813367be8a..f88a715fae 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.
;;;
@@ -2526,6 +2527,29 @@ (define-public font-jetbrains-mono
in small sizes, the text looks crisper.")
(license license:asl2.0)))
+(define-public font-jetbrains-mono-nerd-font
+ (package
+ (name "font-jetbrains-mono-nerd-font")
+ (version "3.1.1")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append
+ "https://github.com/ryanoasis/nerd-fonts/releases/"
+ "download/v" version "/JetBrainsMono.tar.xz"))
+ (sha256
+ (base32
+ "1f8xi8kgyik59ahjm3pcrb2s02c9a9i6kwf5b4651zpjmjy5l8lj"))))
+ (build-system font-build-system)
+ (arguments '(#:license-file-regexp "^OFL\\.txt$"))
+ (home-page "https://nerdfonts.com")
+ (synopsis "Mono typeface for developers with Nerd Fonts patching")
+ (description
+ "JetBrains Mono is a font family dedicated to developers. JetBrains
+Mono’s typeface forms are simple and free from unnecessary details. Rendered
+in small sizes, the text looks crisper. Nerd Fonts patching adds a high number
+of extra glyphs.")
+ (license license:silofl1.1)))
+
(define-public font-juliamono
(package
(name "font-juliamono")
--
2.41.0
S
S
Saku Laesvuori wrote on 13 Dec 2023 09:02
[PATCH 3/5] gnu: font-jetbrains-mono: Use license-file-regexp argument
(address . 67808@debbugs.gnu.org)(name . Saku Laesvuori)(address . saku@laesvuori.fi)
e74e5dd436c48a28f62426ba90cae11e771cba64.1702454367.git.saku@laesvuori.fi
* gnu/packages/fonts.scm (font-jetbrains-mono)[arguments]: Replace
custom 'install-license-files build phase with license-file-regexp
argument.

Change-Id: Ie8b851b04c84c63c5e1abb1e75c9312b4729be57
---
gnu/packages/fonts.scm | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)

Toggle diff (22 lines)
diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm
index f88a715fae..3f4f5ae847 100644
--- a/gnu/packages/fonts.scm
+++ b/gnu/packages/fonts.scm
@@ -2512,13 +2512,8 @@ (define-public font-jetbrains-mono
;; Find the license file outside of the default subdirectory.
(lambda _
(chdir "..")
- #t))
- (replace 'install-license-files
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (doc (string-append out "/share/doc/" ,name "-" ,version)))
- (install-file "OFL.txt" doc)
- #t))))))
+ #t)))
+ #:license-file-regexp "^OFL\\.txt$"))
(home-page "https://www.jetbrains.com/lp/mono/")
(synopsis "Mono typeface for developers")
(description
--
2.41.0
S
S
Saku Laesvuori wrote on 13 Dec 2023 09:02
[PATCH 4/5] gnu: font-jetbrains-mono: Use the correct license.
(address . 67808@debbugs.gnu.org)(name . Saku Laesvuori)(address . saku@laesvuori.fi)
96d08c872e805bd3fdd3612c0f9c2baa0ed9c302.1702454367.git.saku@laesvuori.fi
The build scripts are licensed under asl2.0 but the packaged font files
are licensed under silofl1.1.

* gnu/packages/fonts.scm (font-jetbrains-mono)[license]: Use silofl1.1
instead of asl2.0.

Change-Id: I256a89b6e4bdb368c9cc94cae0808f72c76e7599
---
gnu/packages/fonts.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm
index 3f4f5ae847..52e9cb0987 100644
--- a/gnu/packages/fonts.scm
+++ b/gnu/packages/fonts.scm
@@ -2520,7 +2520,7 @@ (define-public font-jetbrains-mono
"JetBrains Mono is a font family dedicated to developers. JetBrains
Mono’s typeface forms are simple and free from unnecessary details. Rendered
in small sizes, the text looks crisper.")
- (license license:asl2.0)))
+ (license license:silofl1.1)))
(define-public font-jetbrains-mono-nerd-font
(package
--
2.41.0
S
S
Saku Laesvuori wrote on 13 Dec 2023 09:02
[PATCH 5/5] gnu: font-jetbrains-mono: Update to 2.304
(address . 67808@debbugs.gnu.org)(name . Saku Laesvuori)(address . saku@laesvuori.fi)
85eb65309f34d0594b086347fc672a08af67c5de.1702454367.git.saku@laesvuori.fi
* gnu/packages/fonts.scm (font-jetbrains-mono): Update to version 2.304.

Change-Id: Id325fda8f9b50cf830107823c6ca1b439a6bdca0
---
gnu/packages/fonts.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (24 lines)
diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm
index 52e9cb0987..a2bb8a1065 100644
--- a/gnu/packages/fonts.scm
+++ b/gnu/packages/fonts.scm
@@ -2495,7 +2495,7 @@ (define-public font-sil-ezra
(define-public font-jetbrains-mono
(package
(name "font-jetbrains-mono")
- (version "2.242")
+ (version "2.304")
(source
(origin
(method url-fetch)
@@ -2503,7 +2503,7 @@ (define-public font-jetbrains-mono
(string-append "https://github.com/JetBrains/JetBrainsMono/releases/"
"download/v" version "/JetBrainsMono-" version ".zip"))
(sha256
- (base32 "17qs985v38x3rcg3v4av3qynwr4gvixrj50vjzy7zkkny575ncaf"))))
+ (base32 "1gvv5w0vfzndzp8k7g15j5i3yvnpr5z3imrwjs5flq19xp37cqvg"))))
(build-system font-build-system)
(arguments
`(#:phases
--
2.41.0
S
S
Simon South wrote on 13 Dec 2023 15:33
Re: [bug#67808] [PATCH 1/5] guix: build-system: font: Accept license-file-regexp keyword argument
(name . Saku Laesvuori via Guix-patches via)(address . guix-patches@gnu.org)
87zfye2mvd.fsf@simonsouth.net
Thanks for raising this again, Saku.

The issue of the font-build-system not exposing its %license-file-regexp
argument affects a number of font packages that either define a
redundant phase or simply fail to install the right license files from
their distribution. I attempted to address the problem comprehensively
with the patches in issue 61253:


In addition to exposing the "%license-file-regexp" argument the changes
there also provide a default value that matches common font-license file
names (including "OFL.txt") and correct the 29 font packages I found to
have issues.

If there's interest in fixing this, I'm willing to review those patches
to verify they fix the problem globally. Saku's update to the
font-jetbrains-mono package and addition of font-jetbrains-mono-nerd
could then (and maybe should) be handled each as a separate issue.

--
Simon South
simon@simonsouth.net
S
S
Saku Laesvuori wrote on 14 Dec 2023 07:46
(name . Simon South)(address . simon@simonsouth.net)(address . 67808@debbugs.gnu.org)
b6irijuetbr4halj2lhcafnpxcecbdr7qhwekdvsfnpsx4bhgb@xqpgpdbwi2id
Toggle quote (15 lines)
> Thanks for raising this again, Saku.
>
> The issue of the font-build-system not exposing its %license-file-regexp
> argument affects a number of font packages that either define a
> redundant phase or simply fail to install the right license files from
> their distribution. I attempted to address the problem comprehensively
> with the patches in issue 61253:
>
> https://issues.guix.gnu.org/61253
>
> In addition to exposing the "%license-file-regexp" argument the changes
> there also provide a default value that matches common font-license file
> names (including "OFL.txt") and correct the 29 font packages I found to
> have issues.

That looks like a much more complete fix/improvement than mine. Great!

Toggle quote (5 lines)
> If there's interest in fixing this, I'm willing to review those patches
> to verify they fix the problem globally. Saku's update to the
> font-jetbrains-mono package and addition of font-jetbrains-mono-nerd
> could then (and maybe should) be handled each as a separate issue.

Sounds good to me. I'll rebase those patches onto your's now and again
later if needed.
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEoMkZR3NPB29fCOn/JX0oSiodOjIFAmV6pN8ACgkQJX0oSiod
OjKuaA/+MpoJ8HV5SvgjxmT+jTaUPFG/rYi6KTm1FZmxPNglM0Nwz8CwO2k/1GGV
/6sqACSb2NhweWf2iJr+ixE946HupYgLuDn8/TXJTcddwhNIKhCTTQSUZ91sAQwc
0fy4rHZKsJZ3nmyTdK0yb3em/tS/8WbRcpTYvUjQGfqqj1a85t6YeovnjGtubkRU
mFl79zF/k+evAz3iaAwURsR6nPyrIjgOAcMsSNayA6kiHmfFpc4qsPqTObiAEO0W
NRrg5HqzHHfW1SKRLvjG63ECbnNZUkPG2aI1mCDE+zTB/rdApLYtCHJ8Yrdbagwm
cc7pJ9rLTtRxMuOKrQFmGmaHPvBpk0AMlWI+azvxnbip2mXxN6uVttdGN/qGF2YL
rJ+2UyzHHpeZo3lR6MDcnTw7DqfMTC3sgry/135R47rRAShi3Owv2/63L7CedOtP
MtNsX7T/enMk6JsWuYQSX3+oCaqBlIBkaTUg312aZBqz5lB3HhpI00+GEkDlKnYS
pUnmlHrvnUr8wE+8UNCbgYqLMAL7++a7mjNC/afwk6bs6CiXgMlpFEkdo+PYPEFU
an2dOzk0DIb5yyZ1I03aIMkSAUu6Dk3Hk2rcLxH0i9sg8ONWTGDyk3v3Xj/am3I4
DE4JY6n0fLci/puG55A8cgJzCNikNZokhUb0TL51PXIHNN66Au0=
=40s+
-----END PGP SIGNATURE-----


S
S
Saku Laesvuori wrote on 14 Dec 2023 08:35
[PATCH v2 0/1] Add JetBrainsMono Nerd Font
(address . 67808@debbugs.gnu.org)(name . Saku Laesvuori)(address . saku@laesvuori.fi)
cover.1702538852.git.saku@laesvuori.fi
The commits from the earlier serires that don't require the patches
adding the #:license-file-regexp argument have been split to issue

This remaining patch has been rebased on the patch series in
https://issues.guix.gnu.org/61253,which provides a more complete
implementation of #:license-file-regexp and uses it in more packages
that are currently missing license files or require extra phases to
install them.

Saku Laesvuori (1):
gnu: Add font-jetbrains-mono-nerd-font

gnu/packages/fonts.scm | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)


base-commit: 4bf4e340b74b66a0fc319aeb100fb1f948a67211
prerequisite-patch-id: f1a3748021e8151006183f5bf8a3453d95348e4f
prerequisite-patch-id: d0efcb0bae4e140993f7357be85bafc7db2a03a9
prerequisite-patch-id: 32722a903edb46f733a99b5f89a8f0d42ee34f6c
prerequisite-patch-id: 3194c603473c81f60dde6feb43a27b3c1660835f
prerequisite-patch-id: 509e75f9191fadc38ec04f2ab989eba0405f2098
prerequisite-patch-id: 0d5568f0f56d4a9aa42259674c1192e1f8341aaf
prerequisite-patch-id: d925c21152992d98567fe4c97fd938aebb86e52c
prerequisite-patch-id: 79976cb8b9c9b844821cfdec23ed13c8b65f1023
prerequisite-patch-id: bace71a67a9b9f31d3a1e3b724329542e82b9beb
prerequisite-patch-id: 0e3995a7ff4d3ee174db5ad470f514fbbed81c88
prerequisite-patch-id: bfee1b31479e96ab5673a3c7a6b29072808b9b26
prerequisite-patch-id: 60ebfde4db3da5ce38eb2d5ea6b4be5e8d8fe1e5
prerequisite-patch-id: 0cdc659948d06ec8ecf0334524fb1475e03476fe
prerequisite-patch-id: e3792b37a113e83822d5193054da424f9f4bccf4
prerequisite-patch-id: d3e99b0184547ac5fc8447594a2401d737bdc95b
prerequisite-patch-id: 46f87c03fa136a6565462a9f9221c129b98e408b
prerequisite-patch-id: bc4cabfd0780e673a604a408aa97fcebe912be68
prerequisite-patch-id: d981276b0d3b8aa436bdaf28e4f9d5afcd781d66
prerequisite-patch-id: 31e1fa56623253a275f7cb65f60adfaa91b4cf59
--
2.41.0
S
S
Saku Laesvuori wrote on 14 Dec 2023 08:35
[PATCH v2 1/1] gnu: Add font-jetbrains-mono-nerd-font
(address . 67808@debbugs.gnu.org)(name . Saku Laesvuori)(address . saku@laesvuori.fi)
dbd06e7d31e83e7cbd602ea8f6b5ecdeb2d855d9.1702538852.git.saku@laesvuori.fi
* gnu/packages/fonts.scm (font-jetbrains-mono-nerd-font): New variable.

Change-Id: I52e3e3fda5fa83b6b0e865b9e56f008f91a4465c
---
gnu/packages/fonts.scm | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)

Toggle diff (44 lines)
diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm
index 1cb0576974..e1324bded1 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.
;;;
@@ -2532,6 +2533,29 @@ (define-public font-jetbrains-mono
in small sizes, the text looks crisper.")
(license license:asl2.0)))
+(define-public font-jetbrains-mono-nerd-font
+ (package
+ (name "font-jetbrains-mono-nerd-font")
+ (version "3.1.1")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append
+ "https://github.com/ryanoasis/nerd-fonts/releases/"
+ "download/v" version "/JetBrainsMono.tar.xz"))
+ (sha256
+ (base32
+ "1f8xi8kgyik59ahjm3pcrb2s02c9a9i6kwf5b4651zpjmjy5l8lj"))))
+ (build-system font-build-system)
+ (arguments '(#:license-file-regexp "^OFL\\.txt$"))
+ (home-page "https://nerdfonts.com")
+ (synopsis "Mono typeface for developers with Nerd Fonts patching")
+ (description
+ "JetBrains Mono is a font family dedicated to developers. JetBrains
+Mono’s typeface forms are simple and free from unnecessary details. Rendered
+in small sizes, the text looks crisper. Nerd Fonts patching adds a high number
+of extra glyphs.")
+ (license license:silofl1.1)))
+
(define-public font-juliamono
(package
(name "font-juliamono")
--
2.41.0
S
S
Saku Laesvuori wrote on 14 Dec 2023 15:01
[PATCH v3 0/3] Add procedure for patching Nerd Fonts
(address . 67808@debbugs.gnu.org)(name . Saku Laesvuori)(address . saku@laesvuori.fi)
cover.1702560042.git.saku@laesvuori.fi
I had originally planned to package the script that the Nerd Fonts
project uses to patch their fonts and use it to patch the JetBrains Mono
font. Unfortunately, the script is just an unpackaged script and I had
trouble making a sane package definition for it until now.

This series packages that script, adds a procedure for creating a Nerd
Fonts patched copy of an arbitrary package and uses it to package the
JetBrainsMono Nerd Font.

This doesn't depend on the patch series adding missing license files to
many font packages [1] anymore. Changes from the series updating
font-jetbrains-mono[2] that split from this series are independent but
also improve the font-jetbrains-mono-nerd-font package.


Saku Laesvuori (3):
gnu: Add nerd-font-patcher
gnu: Add Nerd Font patching procedure
gnu: Add font-jetbrains-mono-nerd-font

gnu/packages/fonts.scm | 54 ++++++++++++
...nt-patcher-convert-to-python-package.patch | 85 +++++++++++++++++++
gnu/packages/python-xyz.scm | 47 ++++++++++
3 files changed, 186 insertions(+)
create mode 100644 gnu/packages/patches/nerd-font-patcher-convert-to-python-package.patch


base-commit: 4bf4e340b74b66a0fc319aeb100fb1f948a67211
--
2.41.0
S
S
Saku Laesvuori wrote on 14 Dec 2023 15:01
[PATCH v3 1/3] gnu: Add nerd-font-patcher
(address . 67808@debbugs.gnu.org)(name . Saku Laesvuori)(address . saku@laesvuori.fi)
173b07571f7417cc23d53e9557e7ce2871075346.1702561323.git.saku@laesvuori.fi
* gnu/packages/python-xyz.scm (nerd-font-patcher): New variable.
* gnu/packages/patches/nerd-font-patcher-convert-to-python-package.patch:
New file

Change-Id: I5f0b99b5120dfa8835727f4ea9f01c235962eed9
---
...nt-patcher-convert-to-python-package.patch | 85 +++++++++++++++++++
gnu/packages/python-xyz.scm | 47 ++++++++++
2 files changed, 132 insertions(+)
create mode 100644 gnu/packages/patches/nerd-font-patcher-convert-to-python-package.patch

Toggle diff (160 lines)
diff --git a/gnu/packages/patches/nerd-font-patcher-convert-to-python-package.patch b/gnu/packages/patches/nerd-font-patcher-convert-to-python-package.patch
new file mode 100644
index 0000000000..400c608f88
--- /dev/null
+++ b/gnu/packages/patches/nerd-font-patcher-convert-to-python-package.patch
@@ -0,0 +1,85 @@
+This patch
+
+* Creates a pyproject.toml file
+* Changes paths to be more sensible.
+
+It requires extra work in a snippet to work properly, because moving the
+files in a patch would effectively duplicate all the code.
+
+ font-patcher | 13 ++++---------
+ bin/scripts/name_parser/FontnameParser.py | 2 +-
+ pyproject.toml | 13 +++++++++++++
+ 3 files changed, 18 insertions(+), 10 deletions(-)
+ create mode 100644 pyproject.toml
+
+diff --git a/font-patcher b/font-patcher
+index 4cbf46c..89ae402 100755
+--- a/font-patcher
++++ b/font-patcher
+@@ -38,13 +38,9 @@ except ImportError:
+ )
+ )
+
+-sys.path.insert(0, os.path.abspath(os.path.dirname(sys.argv[0])) + '/bin/scripts/name_parser/')
+-try:
+- from FontnameParser import FontnameParser
+- from FontnameTools import FontnameTools
+- FontnameParserOK = True
+-except ImportError:
+- FontnameParserOK = False
++from nerd_font_patcher.name_parser.FontnameParser import FontnameParser
++from nerd_font_patcher.name_parser.FontnameTools import FontnameTools
++FontnameParserOK = True
+
+ class TableHEADWriter:
+ """ Access to the HEAD table without external dependencies """
+@@ -1897,7 +1893,7 @@ def setup_arguments():
+ expert_group.add_argument('--custom', dest='custom', default=False, type=str, help='Specify a custom symbol font, all glyphs will be copied; absolute path suggested')
+
+ expert_group.add_argument('--dry', dest='dry_run', default=False, action='store_true', help='Do neither patch nor store the font, to check naming')
+- expert_group.add_argument('--glyphdir', dest='glyphdir', default=__dir__ + "/src/glyphs/", type=str, help='Path to glyphs to be used for patching')
++ expert_group.add_argument('--glyphdir', dest='glyphdir', default=__dir__ + "/share/fonts/nerd-font-glyphs", type=str, help='Path to glyphs to be used for patching')
+ expert_group.add_argument('--has-no-italic', dest='noitalic', default=False, action='store_true', help='Font family does not have Italic (but Oblique), to help create correct RIBBI set')
+ expert_group.add_argument('-l', '--adjust-line-height', dest='adjustLineHeight', default=False, action='store_true', help='Whether to adjust line heights (attempt to center powerline separators more evenly)')
+ expert_group.add_argument('--metrics', dest='metrics', default=None, choices=get_metrics_names(), help='Select vertical metrics source (for problematic cases)')
+@@ -2068,5 +2064,4 @@ def main():
+
+
+ if __name__ == "__main__":
+- __dir__ = os.path.dirname(os.path.abspath(__file__))
+ main()
+diff --git a/bin/scripts/name_parser/FontnameParser.py b/bin/scripts/name_parser/FontnameParser.py
+index 5768c42..1d95fdc 100644
+--- a/bin/scripts/name_parser/FontnameParser.py
++++ b/bin/scripts/name_parser/FontnameParser.py
+@@ -2,7 +2,7 @@
+ # coding=utf8
+
+ import re
+-from FontnameTools import FontnameTools
++from nerd_font_patcher.name_parser.FontnameTools import FontnameTools
+
+ class FontnameParser:
+ """Parse a font name and generate all kinds of names"""
+diff --git a/pyproject.toml b/pyproject.toml
+new file mode 100644
+index 0000000..e039e68
+--- /dev/null
++++ b/pyproject.toml
+@@ -0,0 +1,13 @@
++[build-system]
++requires = ["setuptools"]
++build-backend = "setuptools.build_meta"
++
++[project]
++name = "font_patcher"
++version = "3.1.1"
++
++[project.scripts]
++font-patcher = "nerd_font_patcher:main"
++
++[tool.setuptools]
++packages = ["nerd_font_patcher", "nerd_font_patcher.name_parser"]
+--
+2.41.0
+
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 86f8d81689..320fd4cb69 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -146,6 +146,7 @@
;;; Copyright © 2023 Janneke Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2023 Attila Lendvai <attila@lendvai.name>
;;; Copyright © 2023 Troy Figiel <troy@troyfigiel.com>
+;;; Copyright © 2023 Saku Laesvuori <saku@laesvuori.fi>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -13611,6 +13612,52 @@ (define-public python-fonttools
python-zopfli))
(properties (alist-delete 'hidden? (package-properties base))))))
+(define-public nerd-font-patcher
+ (package
+ (name "nerd-font-patcher")
+ (version "3.1.1")
+ (source
+ (origin
+ (method url-fetch/zipbomb)
+ (uri
+ (string-append
+ "https://github.com/ryanoasis/nerd-fonts/releases/download/v"
+ version "/FontPatcher.zip"))
+ (sha256
+ (base32 "1wp41ljxa5sjgxhw97cm06icw9n03nmpygr3j9qq3zs5wsxvs4bv"))
+ (snippet #~(begin
+ (rename-file "bin/scripts" "nerd_font_patcher")
+ (rename-file "font-patcher" "nerd_font_patcher/__init__.py")))
+ (patches
+ (search-patches "nerd-font-patcher-convert-to-python-package.patch"))))
+ (build-system pyproject-build-system)
+ (arguments
+ (list
+ #:tests? #f ;no tests available
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-before 'build 'patch-__dir__
+ (lambda _
+ (substitute* "nerd_font_patcher/__init__.py"
+ (("__dir__")
+ (string-append "\"" #$output "\"\n")))))
+ (add-after 'install 'install-glyphs
+ (lambda _
+ (let ((font-directory (string-append #$output "/share/fonts")))
+ (mkdir-p font-directory)
+ (copy-recursively "src/glyphs" (string-append font-directory "/nerd-font-glyphs"))))))))
+ (inputs (list python fontforge))
+ (native-inputs (list python-setuptools))
+ (home-page "https://github.com/ryanoasis/nerd-fonts/#option-9-patch-your-own-font")
+ (synopsis "Script for adding Nerd Fonts glyphs into fonts")
+ (description "This package provides a python script that can be used to add the
+Nerd Fonts glyphs to any font file.")
+ (license (list license:asl2.0
+ license:cc-by4.0
+ license:expat
+ license:silofl1.1
+ license:unlicense))))
+
(define-public python-ly
(package
(name "python-ly")

base-commit: 4bf4e340b74b66a0fc319aeb100fb1f948a67211
--
2.41.0
S
S
Saku Laesvuori wrote on 14 Dec 2023 15:01
[PATCH v3 2/3] gnu: Add Nerd Font patching procedure
(address . 67808@debbugs.gnu.org)(name . Saku Laesvuori)(address . saku@laesvuori.fi)
f9d5a9688aac069792860f92a642949db1f77204.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(+)

Toggle diff (81 lines)
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
S
S
Saku Laesvuori wrote on 14 Dec 2023 15:01
[PATCH v3 3/3] gnu: Add font-jetbrains-mono-nerd-font
(address . 67808@debbugs.gnu.org)(name . Saku Laesvuori)(address . saku@laesvuori.fi)
6b637a574c69bb422240ddda6de7073b36d3012a.1702561323.git.saku@laesvuori.fi
* gnu/packages/fonts.scm (font-jetbrains-mono-nerd-font): New variable.

Change-Id: I61b356b1ac57a030e6fa3f8236afcb07daf02c9f
---
gnu/packages/fonts.scm | 3 +++
1 file changed, 3 insertions(+)

Toggle diff (16 lines)
diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm
index 3568f38c60..bcddf71d27 100644
--- a/gnu/packages/fonts.scm
+++ b/gnu/packages/fonts.scm
@@ -2580,6 +2580,9 @@ (define-public font-jetbrains-mono
(define-public font-jetbrains-mono-nerd-font
(patch-nerd-font font-jetbrains-mono))
+(define-public font-jetbrains-mono-nerd-font
+ (patch-nerd-font font-jetbrains-mono))
+
(define-public font-juliamono
(package
(name "font-juliamono")
--
2.41.0
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 67808@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 67808
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch