guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#57963] [PATCH v2] home: fontutils: Support user's fontconfig.


From: Ludovic Courtès
Subject: [bug#57963] [PATCH v2] home: fontutils: Support user's fontconfig.
Date: Thu, 22 Sep 2022 10:53:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux)

Hi Andrew,

Andrew Tropin <andrew@trop.in> skribis:

> 2. We had a discussion with Ludovic about rde home services vs guix home
> services styles.  And this one looks like rde style, not guix.
>
> rde takes arbitrary s-exps and g-exps with optional structure checks and
> serializes them to target format.
>
> guix uses nested records with rigid nesting structure.

That’s generally true, but it’s not black and white and there’s room for
discussion.  :-)

In this case, Taiju’s proposal is to let users write snippets like this:

--8<---------------cut here---------------start------------->8---
    (define font-family-map
      '((sans-serif . "Noto Sans CJK JP")
        (serif . "Noto Serif CJK JP")))

    (home-environment
     (packages (list font-google-noto))
     (services
      (list
       (simple-service 'my-fontconfig-service
                       home-fontconfig-service-type
                       (list
                        (call-with-output-string
                          (lambda (port)
                            (sxml->xml
                             (map (lambda (pair)
                                    `(alias
                                      (family ,(car pair))
                                      (prefer
                                       (family ,(cdr pair)))))
                                  font-family-map)
                             port))))))))
--8<---------------cut here---------------end--------------->8---

(With v2 they’d provide SXML instead of XML-in-a-string, so it’s
slightly less verbose but quite similar.)

In this particular case, I would find it easier to use if one could
provide a set of <font-alias> records, let’s say along these lines:

  (simple-service 'my-fontconfig-service
                  home-fontconfig-service-type
                  (list (font-alias 'sans-serif "Noto Sans CJK JP") …))

That way, users wouldn’t need to know the details of the XML syntax for
fontconfig.

The downside is that it restricts what can be done: it lets you add font
aliases, but nothing more.

Do you have other use cases in mind, Taiju?

Thanks,
Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]