Subject: [bug#57963] [PATCH 0/1] Support user's fontconfig.

From: Taiju HIGASHI <[email-masked]>
Date: Wed, 21 Sep 2022 09:27:20 +0900

Hi,

I want to add custom fontconfig, so I've implemented the ability of custom
font configuration to fontutils.

It allows us to set up our fontconfig as follows.

    (home-environment
     (packages (list font-google-noto))
     (services
      (list
       (simple-service 'my-fontconfig-service
                       home-fontconfig-service-type
                       (list
                        "<alias>
      <family>sans-serif</family>
      <prefer>
        <family>Noto Sans CJK JP</family>
      </prefer>
    </alias>"
                        "<alias>
      <family>sans-serif</family>
      <prefer>
        <family>Noto Serif CJK JP</family>
      </prefer>
    </alias>")))))

Of course, we can also use SXML!

    (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))))))))

Taiju HIGASHI (1):
  home: fontutils: Support user's fontconfig.

 gnu/home/services/fontutils.scm | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

--
2.37.3