unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Danny Milosavljevic <dannym@scratchpost.org>
To: Arun Isaac <arunisaac@systemreboot.net>
Cc: guix-devel@gnu.org
Subject: font-build-system vs fc-cache profile hook
Date: Fri, 12 May 2017 00:19:22 +0200	[thread overview]
Message-ID: <20170512001922.1d54fb2b@scratchpost.org> (raw)
In-Reply-To: <20170511201500.xopertmlrwg4pvue@abyayala>

Hi Arun,
Hi ng0,

On Thu, 11 May 2017 20:15:00 +0000
ng0 <ng0@pragmatique.xyz> wrote:

> I don't think anyone is working on a font-build-system. But this won't
> solve the fc-cache problem as the reply by Mark suggests.

I agree, it won't.

For that, one could merge-install the fonts in a well-known location (that already happens) and then add a profile hook to guix/profiles.scm (%default-profile-hooks).

But there's already a "fonts-dir-file" hook there - which was recently extended to actually traverse all the font dirs and invoke mkfontscale, mkfontdir in them.

So for fixing the font problem it would first require someone to find out what exactly is missing.  What does fc-cache do that mkfontdir and mkfontscale don't?  Is it necessary to invoke all three?  Then we could just invoke all three in the fonts-dir-file hook (or invoke fc-cache in a new hook?).

Note that fc-cache needs to be invoked once per architecture, so it isn't quite as straightforward as it would seem (for example on x86, you'd potentially have to run it once for x86_64 and once for i386 - which means you'd have to find out which architectures are used in the profile).

You can pass a list of "interesting" directories as command-line parameters to fc-cache.

fc-cache supports both user caches and system caches.  You'd have to find out which of those is more appropriate.  Probably the system cache?  So invoke fc-cache "--system-only" ?

Also, can fc-cache handle the Guix timestamp-less directories?  If not, it would have to be invoked with "--force" "--really-force" (the latter makes it unlink existing cache files, the former prevents it from trying to load cache files afterwards).  Would that be slow?

One cache dir is specified when building fontconfig, called FC_CACHEDIR, which can be specified when invoking configure: "--with-cache-dir=DIR" (defaults to LOCALSTATEDIR/cache/fontconfig).  The Guix package for fontconfig overrides it to be /var/cache/fontconfig and I have a lot of files in there (I'm a GuixSD user).

Not sure whether that's good.  Why not put the cache into the profile and have an environment variable point there?  Just using "/var" sounds unsafe for non-GuixSD users... what if the foreign operating system has incompatible files there?  Also, reproducibility?

On the other hand, user cachedirs are in the directory specified by environment variable XDG_CACHE_HOME.

Each cache corresponds to a list of font directories - which are found by appending sysroot and an entry in the cache body.  If sysroot is not set, just the entry in the cache body is used.  I think the former is because the cache filename is a MD5SUM of the font directory name - which can lead to hash collisions.  But later on, FcDirCacheUnlink just unlinks the cache of each directory specified (on really-force, for example) - so if you specify just one of the directories that would cause a collision it will silently invalidate the other one too (which you didn't specify). :P

What are these cache files caching in the first place?  Don't mkfontdir and mkfontscale already cache font family, variant etc?

Also, reading the Arch bugtracker, if not running fc-cache, fontconfig is supposed to generate the cache into the user directory automatically when invoking an application that needs fontconfig fonts.  Not sure how it can happen for them to be broken...

In any case, invoking fc-cache --system-only can't hurt I guess.

But first it would be good to strace some application with broken fonts and see what it's trying to open that fails.

  reply	other threads:[~2017-05-11 22:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-05 12:58 font-build-system ng0
2017-02-13 14:59 ` font-build-system Ludovic Courtès
2017-05-11 19:34 ` font-build-system Arun Isaac
2017-05-11 20:15   ` font-build-system ng0
2017-05-11 22:19     ` Danny Milosavljevic [this message]
2017-05-13  5:10     ` font-build-system Arun Isaac
     [not found]     ` <cu7bmqx1gvl.fsf@systemreboot.net>
2017-05-15 16:35       ` font-build-system Arun Isaac

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=20170512001922.1d54fb2b@scratchpost.org \
    --to=dannym@scratchpost.org \
    --cc=arunisaac@systemreboot.net \
    --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).