From: Ivan Kozlov <kanichos@yandex.ru>
To: guix-devel <guix-devel@gnu.org>
Subject: Making the core fonts work
Date: Fri, 14 Feb 2020 09:44:16 +0300 [thread overview]
Message-ID: <21346771581662656@myt5-bc0f9d8e5f27.qloud-c.yandex.net> (raw)
Hello.
You should know that it is currently non-trivial to make the X.org server use fonts from a profile. You basically have to manually sift through the font files and find their ‘dirname’. The ‘fonts-dir’ union directories that Guix generates and installs into profiles have been useless since forever and in fact only get in the way; this is because the X.org server will not follow symbolic links to font files.
I was reading the Xserver(1) man page and noticed that it supports ‘font catalogue’ directories. They should contain symbolic links to actual font directories that will be added to the font path. This should allow a very nice solution.
Something like this:
(define (fontpath-file manifest)
(define build
#~(begin
(use-modules (srfi srfi-1) (srfi srfi-26) (guix build utils))
(let* ((top-font-dirs (filter file-exists?
(map (cut string-append <>
"/share/fonts")
'#$(manifest-inputs manifest))))
(font-dirs (append-map (lambda (dir)
(find-files dir
(lambda (file stat)
(and (eq? 'directory (stat:type stat))
(file-exists? (string-append file "/fonts.dir"))))
#:directories? #t)) top-font-dirs)))
(mkdir #$output)
(chdir #$output)
(if (null? font-dirs)
(exit #t)
(for-each (lambda (dir pri)
(symlink dir (string-append (basename dir) ":pri=" pri)))
font-dirs
(map number->string (iota (length font-dirs) 1)))))))
(gexp->derivation "fontpath.d" build
#:modules '((guix build utils)
(srfi srfi-1)
(srfi srfi-26))
#:local-build? #t
#:substitutable? #f
#:properties
`((type . profile-hook)
(hook . fontpath-dir))))
This should be installed somewhere in the profile. Then you set the font path to "catalogue:$HOME/.guix-profile/share/fontpath.d" and everything works like a charm.
I am unqualified to make the actual patch that would add this functionality into Guix.
next reply other threads:[~2020-02-14 6:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-14 6:44 Ivan Kozlov [this message]
2020-02-14 8:58 ` Making the core fonts work Pierre Neidhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=21346771581662656@myt5-bc0f9d8e5f27.qloud-c.yandex.net \
--to=kanichos@yandex.ru \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).