GNU bug report logs - #60498
[PATCH] home: services: fontutils: Add service value.

Previous Next

Package: guix-patches;

Reported by: goodoldpaul <at> autistici.org

Date: Mon, 2 Jan 2023 17:44:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 60498 in the body.
You can then email your comments to 60498 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#60498; Package guix-patches. (Mon, 02 Jan 2023 17:44:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to goodoldpaul <at> autistici.org:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 02 Jan 2023 17:44:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: goodoldpaul <at> autistici.org
To: guix-patches <at> gnu.org
Subject: [PATCH] home: services: fontutils: Add service value.
Date: Mon, 02 Jan 2023 17:43:04 +0000
Dear Guixers,

I'm sending a patch to allow for multiple directories in 
home-fontconfig-service-type's configuration.

Thank you for your time and efforts,

giacomo




Information forwarded to guix-patches <at> gnu.org:
bug#60498; Package guix-patches. (Mon, 02 Jan 2023 17:46:02 GMT) Full text and rfc822 format available.

Message #8 received at 60498 <at> debbugs.gnu.org (full text, mbox):

From: Giacomo Leidi <goodoldpaul <at> autistici.org>
To: 60498 <at> debbugs.gnu.org
Cc: Giacomo Leidi <goodoldpaul <at> autistici.org>
Subject: [PATCH] home: services: fontutils: Add service value.
Date: Mon,  2 Jan 2023 18:44:51 +0100
* gnu/home/services/fontutils.scm (add-fontconfig-config-file): Add
support for multiple paths;
(home-fontconfig-service-type): Honor it;
* doc/guix.texi (Fonts Services): Document it.
---
 doc/guix.texi                   | 25 +++++++++++++++++++++++++
 gnu/home/services/fontutils.scm | 18 ++++++++++++------
 2 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 5c85680831..1e70dd05c0 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -40980,6 +40980,7 @@ services)}.
 * SSH: Secure Shell.                                   Setting up the secure shell client.
 * Desktop: Desktop Home Services.                      Services for graphical environments.
 * Guix: Guix Home Services.                            Services for Guix.
+* Fonts: Fonts Home Services.                          Services for managing User's fonts.
 @end menu
 @c In addition to that Home Services can provide
 
@@ -41856,6 +41857,30 @@ A typical extension for adding a channel might look like this:
 @end lisp
 @end defvr
 
+@node Fonts Services
+@subsection Fonts Home Services
+
+The @code{(gnu home services fontutils)} module provides services for
+user-specific @code{fontconfig} setup.
+
+@defvr {Scheme Variable} home-fontconfig-service-type
+This is the service type for generating configurations for @code{fontconfig} and @code{fc-*} utilities.
+Its associated value is a list of strings (or gexps) pointing to fonts locations.
+
+Generally, it is better to extend this service than to directly
+configure it, as its default value is the default Guix Home's profile
+font installation path (@code{~/.guix-home/profile/share/fonts}).  If you configure this
+service directly, be sure to include the above path.
+
+A typical extension for adding an additional path might look like this:
+
+@lisp
+(simple-service 'additional-fonts-service
+                home-fontconfig-service-type
+                (list "~/.nix-profile/share/fonts"))
+@end lisp
+@end defvr
+
 @node Invoking guix home
 @section Invoking @command{guix home}
 
diff --git a/gnu/home/services/fontutils.scm b/gnu/home/services/fontutils.scm
index 6062eaed6a..f959ee4fd6 100644
--- a/gnu/home/services/fontutils.scm
+++ b/gnu/home/services/fontutils.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2021 Andrew Tropin <andrew <at> trop.in>
 ;;; Copyright © 2021 Xinglu Chen <public <at> yoctocell.xyz>
+;;; Copyright © 2023 Giacomo Leidi <goodoldpaul <at> autistici.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,6 +22,7 @@ (define-module (gnu home services fontutils)
   #:use-module (gnu home services)
   #:use-module (gnu packages fontutils)
   #:use-module (guix gexp)
+  #:use-module (srfi srfi-1)
 
   #:export (home-fontconfig-service-type))
 
@@ -33,15 +35,17 @@ (define-module (gnu home services fontutils)
 ;;;
 ;;; Code:
 
-(define (add-fontconfig-config-file he-symlink-path)
+(define (add-fontconfig-config-file paths)
   `(("fontconfig/fonts.conf"
      ,(mixed-text-file
        "fonts.conf"
-       "<?xml version='1.0'?>
+       (apply string-append
+              `("<?xml version='1.0'?>
 <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
-<fontconfig>
-  <dir>~/.guix-home/profile/share/fonts</dir>
-</fontconfig>"))))
+<fontconfig>\n" ,@(map (lambda (path)
+                         (string-append "  <dir>" path "</dir>\n"))
+                       paths)
+                "</fontconfig>\n"))))))
 
 (define (regenerate-font-cache-gexp _)
   `(("profile/share/fonts"
@@ -59,7 +63,9 @@ (define home-fontconfig-service-type
                        (service-extension
                         home-profile-service-type
                         (const (list fontconfig)))))
-                (default-value #f)
+                (compose concatenate)
+                (extend append)
+                (default-value '("~/.guix-home/profile/share/fonts"))
                 (description
                  "Provides configuration file for fontconfig and make
 fc-* utilities aware of font packages installed in Guix Home's profile.")))

base-commit: 7efcf36e3b753a1dba6f8208f3c22d151007eaf0
-- 
2.38.1





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Tue, 31 Jan 2023 22:07:02 GMT) Full text and rfc822 format available.

Notification sent to goodoldpaul <at> autistici.org:
bug acknowledged by developer. (Tue, 31 Jan 2023 22:07:02 GMT) Full text and rfc822 format available.

Message #13 received at 60498-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Giacomo Leidi <goodoldpaul <at> autistici.org>
Cc: 60498-done <at> debbugs.gnu.org
Subject: Re: bug#60498: [PATCH] home: services: fontutils: Add service value.
Date: Tue, 31 Jan 2023 23:06:03 +0100
[Message part 1 (text/plain, inline)]
Hi Giacomo,

Giacomo Leidi <goodoldpaul <at> autistici.org> skribis:

> * gnu/home/services/fontutils.scm (add-fontconfig-config-file): Add
> support for multiple paths;
> (home-fontconfig-service-type): Honor it;
> * doc/guix.texi (Fonts Services): Document it.

Applied with the cosmetic changes below.

Thanks!

Ludo’.

[Message part 2 (text/x-patch, inline)]
diff --git a/doc/guix.texi b/doc/guix.texi
index f72deb3222..64873db00b 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -42015,29 +42015,34 @@ A typical extension for adding a channel might look like this:
 @end lisp
 @end defvar
 
-@node Fonts Services
+@node Fonts Home Services
 @subsection Fonts Home Services
 
 The @code{(gnu home services fontutils)} module provides services for
-user-specific @code{fontconfig} setup.
+user-specific Fontconfig setup.  The
+@uref{https://www.freedesktop.org/wiki/Software/fontconfig,Fontconfig}
+library is used by many applications to access fonts on the system.
 
-@defvr {Scheme Variable} home-fontconfig-service-type
-This is the service type for generating configurations for @code{fontconfig} and @code{fc-*} utilities.
-Its associated value is a list of strings (or gexps) pointing to fonts locations.
+@defvar home-fontconfig-service-type
+This is the service type for generating configurations for Fontconfig.
+Its associated value is a list of strings (or gexps) pointing to fonts
+locations.
 
 Generally, it is better to extend this service than to directly
 configure it, as its default value is the default Guix Home's profile
-font installation path (@code{~/.guix-home/profile/share/fonts}).  If you configure this
-service directly, be sure to include the above path.
+font installation path (@file{~/.guix-home/profile/share/fonts}).  If
+you configure this service directly, be sure to include the above
+directory.
 
-A typical extension for adding an additional path might look like this:
+A typical extension for adding an additional font directory might look
+like this:
 
 @lisp
 (simple-service 'additional-fonts-service
                 home-fontconfig-service-type
                 (list "~/.nix-profile/share/fonts"))
 @end lisp
-@end defvr
+@end defvar
 
 @node Invoking guix home
 @section Invoking @command{guix home}
diff --git a/gnu/home/services/fontutils.scm b/gnu/home/services/fontutils.scm
index f959ee4fd6..3399cb7ec8 100644
--- a/gnu/home/services/fontutils.scm
+++ b/gnu/home/services/fontutils.scm
@@ -35,16 +35,16 @@ (define-module (gnu home services fontutils)
 ;;;
 ;;; Code:
 
-(define (add-fontconfig-config-file paths)
+(define (add-fontconfig-config-file directories)
   `(("fontconfig/fonts.conf"
      ,(mixed-text-file
        "fonts.conf"
        (apply string-append
               `("<?xml version='1.0'?>
 <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
-<fontconfig>\n" ,@(map (lambda (path)
-                         (string-append "  <dir>" path "</dir>\n"))
-                       paths)
+<fontconfig>\n" ,@(map (lambda (directory)
+                         (string-append "  <dir>" directory "</dir>\n"))
+                       directories)
                 "</fontconfig>\n"))))))
 
 (define (regenerate-font-cache-gexp _)

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 01 Mar 2023 12:24:13 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 54 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.