[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig con
From: |
Taiju HIGASHI |
Subject: |
[bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration. |
Date: |
Thu, 20 Oct 2022 06:42:54 +0900 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) |
Taiju HIGASHI <higashi@taiju.info> writes:
> Hi,
>
> Ludovic Courtès <ludo@gnu.org> writes:
>
>> Hi,
>>
>> Taiju HIGASHI <higashi@taiju.info> skribis:
>>
>>> Andrew Tropin <andrew@trop.in> writes:
>>
>> [...]
>>
>>>>> Andrew Tropin <andrew@trop.in> skribis:
>>>>>
>>>>>> If serialization would support G-exps, we could write
>>>>>>
>>>>>> (list #~"RAW_XML_HERE")
>>>>>
>>>>> There’s a one-to-one lossless mapping between XML and SXML, so I don’t
>>>>> think it makes sense to support XML-in-strings when we have SXML.
>>>>>
>>>>> The only thing it would give us, as I see it, is the ability to generate
>>>>> syntactically-invalid XML. Maybe we can live without it? :-)
>>>>
>>>> Of course we can :), but we won't be able:
>>>>
>>>> 1. To take already existing xml config and use it without rewriting.
>>>
>>> I find it surprisingly important to be able to simply copy and paste
>>> settings without having to rewrite existing settings or those listed on
>>> a web page somewhere. I know we can easily convert from XML to SXML,
>>> but those unfamiliar with SXML may find it a bothering task.
>>
>> OK, that makes sense.
>>
>> But then, let’s not allow users to intersperse XML-in-strings in the
>> middle of XML. It should be either a user-provided file/string or the
>> generated config, but not a mixture of both; that’d be a recipe for
>> confusion.
>>
>> How about this: the service takes either a <fontconfig-configuration>
>> record or a file-like object?
>>
>> (We can even have a “gexp compiler” for <fontconfig-configuration> to
>> make that transparent.)
>
> Thank you for your consideration.
>
> That idea sounds good. I don't know if I can successfully implement
> this, but I will consider it and give it a try.
>
> Thanks,
I'm trying to implement the following, is it consistent with the intent
of what you suggested?
--8<---------------cut here---------------start------------->8---
(define (add-fontconfig-config-file user-config)
`(("fontconfig/fonts.conf"
,(if (home-fontconfig-configuration? user-config)
(mixed-text-file
"fonts.conf"
"<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>"
(serialize-configuration user-config
home-fontconfig-configuration-fields)
"</fontconfig>\n")
user-config))))
--8<---------------cut here---------------end--------------->8---
It is assumed that configurations can be specified in one of the
following ways.
* fontconfig-configuration:
--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
(cons* "~/fonts" %home-fontconfig-base-font-directories))
(default-font-serif-family "Noto Serif CJK JP")
(default-font-sans-serif-family "Noto Sans Serif CJK JP")
(default-font-monospace-family "PlemolJP Console")
(extra-config
'(foo "bar"))))))))
--8<---------------cut here---------------end--------------->8---
Note:
%home-fontconfig-base-font-directories is the new variable I plan to
export as the default value, based on Andrew's and Liliana's point.
* file-like objects:
--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 => (local-file "/path/to/your/fonts.conf"))))))
--8<---------------cut here---------------end--------------->8---
Thanks,
--
Taiju
- [bug#57963] Almost plain SXML serializer, (continued)
- [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration., Andrew Tropin, 2022/10/12
- [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration., Taiju HIGASHI, 2022/10/12
- [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration., Andrew Tropin, 2022/10/12
- [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration., Ludovic Courtès, 2022/10/13
- [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration., Andrew Tropin, 2022/10/14
- [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration., Taiju HIGASHI, 2022/10/15
- [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration., Ludovic Courtès, 2022/10/17
- [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration., Taiju HIGASHI, 2022/10/18
- [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration.,
Taiju HIGASHI <=
- [bug#57963] [PATCH 0/1] Support user's fontconfig., Declan Tsien, 2022/10/20
- [bug#57963] [PATCH 0/1] Support user's fontconfig., Taiju HIGASHI, 2022/10/20
- [bug#57963] [PATCH 0/1] Support user's fontconfig., Declan Tsien, 2022/10/20
- [bug#57963] [PATCH 0/1] Support user's fontconfig., Taiju HIGASHI, 2022/10/20
- [bug#57963] [PATCH 0/1] Support user's fontconfig., Declan Tsien, 2022/10/20
- [bug#57963] [PATCH 0/1] Support user's fontconfig., Taiju HIGASHI, 2022/10/20
- [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration., Taiju HIGASHI, 2022/10/27
- [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration., Liliana Marie Prikler, 2022/10/27
- [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration., Taiju HIGASHI, 2022/10/27
- [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration., Liliana Marie Prikler, 2022/10/27