[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#57963] [PATCH v4 2/2] home: fontutils: Support user's fontconfig.
From: |
liliana . prikler |
Subject: |
[bug#57963] [PATCH v4 2/2] home: fontutils: Support user's fontconfig. |
Date: |
Sat, 01 Oct 2022 18:14:51 +0200 |
User-agent: |
Evolution 3.46.0 |
Am Samstag, dem 01.10.2022 um 20:19 +0900 schrieb Taiju HIGASHI:
> liliana.prikler@gmail.com writes:
>
> > Am Donnerstag, dem 29.09.2022 um 23:36 +0900 schrieb Taiju HIGASHI:
> > > * gnu/home/services/fontutils.scm: Support user's fontconfig.
> > > ---
> > > gnu/home/services/fontutils.scm | 86
> > > ++++++++++++++++++++++++++++++-
> > > --
> > > 1 file changed, 80 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/gnu/home/services/fontutils.scm
> > > b/gnu/home/services/fontutils.scm
> > > index 6062eaed6a..32127740f6 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@trop.in>
> > > ;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
> > > +;;; Copyright © 2022 Taiju HIGASHI <higashi@taiju.info>
> > > ;;;
> > > ;;; This file is part of GNU Guix.
> > > ;;;
> > > @@ -20,9 +21,16 @@
> > > (define-module (gnu home services fontutils)
> > > #:use-module (gnu home services)
> > > #:use-module (gnu packages fontutils)
> > > + #:use-module (gnu services configuration)
> > > #:use-module (guix gexp)
> > > + #:use-module (guix records)
> > > + #:use-module (srfi srfi-1)
> > > + #:use-module (sxml simple)
> > > + #:use-module (ice-9 match)
> > >
> > > - #:export (home-fontconfig-service-type))
> > > + #:export (home-fontconfig-service-type
> > > + home-fontconfig-configuration
> > > + default-font))
> > >
> > > ;;; Commentary:
> > > ;;;
> > > @@ -33,15 +41,81 @@ (define-module (gnu home services fontutils)
> > > ;;;
> > > ;;; Code:
> > >
> > > -(define (add-fontconfig-config-file he-symlink-path)
> > > +(define (default-font-sanitizer type)
> > > + (lambda (value)
> > > + (if (null? value)
> > > + value
> > > + `(alias
> > > + (family ,type)
> > > + (prefer
> > > + (family ,value))))))
> > > +
> > > +(define-record-type* <default-font> default-font
> > > + make-default-font
> > > + default-font?
> > > + (serif default-font-serif
> > > + (default '())
> > > + (sanitize (default-font-sanitizer 'serif)))
> > > + (sans-serif defalut-font-sans-serif
> > default-font-sans-serif
> > > + (default '())
> > > + (sanitize (default-font-sanitizer 'sans-serif)))
> > > + (monospace default-font-monospace
> > > + (default '())
> > > + (sanitize (default-font-sanitizer 'monospace))))
> > Rather than having a null default and sanitizing the field as here,
> > can
> > we have an #f default and omit the field?
> >
> > Btw. I'm not sure whether making this an extra record is the right
> > idea. Wouldn't "default-(serif|sans-serif|monospace)-family" at
> > the
> > root make more sense?
> >
> > Cheers
>
> Do you mean to write as follows?
>
> --8<---------------cut here---------------start------------->8---
> (home-environment
> (packages (list font-google-noto))
> (services
> (append
> (list
> (service home-bash-service-type))
> (modify-services %home-base-services
> (home-fontconfig-service-type
> config => (home-fontconfig-configuration
> (font-directories
> (list "~/fonts"))
> (default-serif-family "Noto Serif CJK JP")
> (default-sans-serif-family "Noto Sans CJK JP")
> (extra-config
> `((match (@ (target font))
> (edit (@ (mode assign)
> (name antialias))
> (bool true)))))))))))
> --8<---------------cut here---------------end--------------->8---
Yep. Feels more natural imho.