bug#38498: Fontconfig does not find fonts in non-default profiles

2022-08-19 Thread Maxim Cournoyer
Hi Pierre,

Pierre Neidhardt  writes:

> The fontconfig package has this bit:
>
> (string-append "--with-add-fonts="
>   "~/.guix-profile/share/fonts,"
>   "/run/current-system/profile/share/fonts")
>
> If I understand correctly, fonts can only be installed at the system
> level or in ~/.guix-profile.

This is no longer true, since commit
c738a054cac00441a4f697f0b40705d0b3f4a7a7, which allowed fontconfig to
find fonts via a search path specification using XDG_DATA_DIRS.

Closing.

Maxim





bug#38498: Fontconfig does not find fonts in non-default profiles

2019-12-16 Thread zimoun
Hi Bengt,

On Sun, 15 Dec 2019 at 23:15, Bengt Richter  wrote:

> How about an interplanetary font folder? cf. IPLD[1] :-)

I am not sure it is related to the issue discussed here, IMHO.

However, if you are interested in IPFS stuff, give a look at this
patch [#] because it still needs some love to be merged...

[#] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=33899


All the best,
simon





bug#38498: Fontconfig does not find fonts in non-default profiles

2019-12-15 Thread Bengt Richter
Hi Guix,

On +2019-12-13 14:11:13 +0100, Pierre Neidhardt wrote:
> Just read this:
> https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/126
> 
> Could we do the following: use a profile hook to generate a config file
> and set the environment variable FONTCONFIG_FILE to this file?
> 
> (I feel that we can't do that because the path of the hook-generated
> cannot be known in advance.)
> 
> 
> I looked at what NixOS does in
> nixpkgs/pkgs/development/libraries/fontconfig/default.nix:
> 
> >  - NixOS creates /etc/fonts/${configVersion}/fonts.conf link to 
> > $out/etc/fonts/fonts.conf,
> > and other modifications should go to /etc/fonts/${configVersion}/conf.d
> 
┌─┐
│ > We don't have a global font folder and we probably don't want to have │
│ > one, so I guess this is not ideal.│
└─┘
>

How about an interplanetary font folder? cf. IPLD[1] :-)

I'm thinking fonts might be a good use case as content-addressable items
identified by what I call vbr's (Verifiable Blob References). A poc vbr
implementation is demoed below.

[1] git clone https://github.com/ipld/specs.git


> The  fontconfig setting in Nix is
> 
> --8<---cut here---start->8---
>   
>   ~/.nix-profile/lib/X11/fonts
>   ~/.nix-profile/share/fonts
>   
>   /nix/var/nix/profiles/default/lib/X11/fonts
>   /nix/var/nix/profiles/default/share/fonts
> --8<---cut here---end--->8---
> 
> so it probably suffers from the same issue.
>

I have been working on my own spin on content-addressability
by way of what I call a vbr -- Verifiable Blob Reference.
It is a name that can be used for a symbolic link or a filename.

It is formed by a prefix followed by a guix hash followed by a
single hyphen followed by the basename of the file (or -bnam opt), like
prefix-hash-basename -- but the final guix hash you see in the final name
is not the guix hash of the file bytes, though that is used to form
an intermediate name string ("prefix-hashOfFileBytes-basename").
The final hash in the final name is a guix hash of the intermediate
name string per se, and _that_ hash is placed between "prefix-" and
"-basename" to form the final name so that the final name is
"prefix-hashOfIntermediateNameString-basename"

So the final name's hash is dependent on both the source bytes
and characters of the name. I'm hoping it will be hard to modify
source file bytes to produce the same final name.

I'm thinking is kind of like the old trick of taking the CRC32
of a packet with the CRC slot set to a known value and stuffing
the resulting CRC back in that slot.

I am not a crypto expert by any means, so comments on weaknesses
are appreciated. The above describes one variant. There is also
a self-referential version where the vbr text can be embedded in
the file, but that requires a substitution trick in the file byte
stream feeding the hash so the self-reference slot(s) can be
fixed value(s) during hashing. Still a wip but a single slot in
first or last pages of a file is not too bad :-) This in turn
has text vs binary variations. I've seen similar to the latter
described, but not my repeat hash vbr method, though I wouldn't
be that surprised if someone says, "Yeah, that's called frobulation."
or something.

I am re-inventing wheels I notice every time a scan the internet,
but hope to contribute something useful, eventually :)

Since this started with fonts, I'll start with a sample
┌──┐
│ this shows verifiable blob reference (vbr) names for duplicated 12x22 
font files │
├──┤
│ $ find /gnu -type f -iname '*12x22*'|while read x;do vbr GxFont12x22- $x;done 
   │
│ 
GxFont12x22-0jhp0cswgvpg4awc7cnadi9jymglnfryj0l9fcg1z7wd5sw8210a-sun12x22.psfu.gz
│
│ 
GxFont12x22-0ylkkdlwhzfw3dadsqhhh021xafz97zajc3qcgrbv6vmdlk3chpn-LatGrkCyr-12x22.psfu.gz
 │
│ 
GxFont12x22-0awqnypd4np6zpjy12wd2fq5ri9ifamapadfmn1h9k2vjjnndwpd-iso01-12x22.psfu.gz
 │
│ 
GxFont12x22-1hy97l5n7363q5w5x19f7c8klabbprrpx5r1ki4swbn372326jgl-iso02-12x22.psfu.gz
 │
│ GxFont12x22-1zrlk9zvpkmhcl0cyxy5pnm6mqy7qranx40gz5gy3wvf0cnpm6dp-README.12x22 
   │
│ $ 
   │
│ $ find /usr -type f -iname '*12x22*'|while read x;do vbr GxFont12x22- $x;done 
   │
│ find: ?/usr/share/polkit-1/rules.d?: Permission denied
   │
│ 
GxFont12x22-0jhp0cswgvpg4awc7cnadi9jymglnfryj0l9fcg1z7wd5sw8210a-sun12x22.psfu.gz
│
│ 
GxFont12x22-0ylkkdlwhzfw3dadsqhhh021xafz97zajc3qcgrbv6vmdlk3chpn-LatGrkCyr-12x22.psfu.gz
 │
│ 

bug#38498: Fontconfig does not find fonts in non-default profiles

2019-12-14 Thread Ludovic Courtès
Hello,

Pierre Neidhardt  skribis:

> Just read this:
> https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/126
>
> Could we do the following: use a profile hook to generate a config file
> and set the environment variable FONTCONFIG_FILE to this file?

I guess that would work.

> (I feel that we can't do that because the path of the hook-generated
> cannot be known in advance.)

‘FONTCONFIG_FILE’ could be a search path of ‘fontconfig’ (the usual
way), but then we’d hit ,
meaning that it would not be set automatically.

Thoughts?

Ludo’.





bug#38498: Fontconfig does not find fonts in non-default profiles

2019-12-12 Thread Ludovic Courtès
Hi!

Pierre Neidhardt  skribis:

> Ludovic Courtès  writes:
>
>> We could fix that by adding a patch so that Fontconfig would honor
>> $FONTCONFIG_FONT_PATH or similar.
>
> Have we ever asked upstream?  Maybe they would consider adding it.
> If they don't, I'm in favour of a patch! :)

I don’t think anyone asked upstream and I agree that we should!  It
could help to have a patch ready to get the discussion started anyway.

Thanks,
Ludo’.





bug#38498: Fontconfig does not find fonts in non-default profiles

2019-12-10 Thread Pierre Neidhardt
Hi!

Ludovic Courtès  writes:

> We could fix that by adding a patch so that Fontconfig would honor
> $FONTCONFIG_FONT_PATH or similar.

Have we ever asked upstream?  Maybe they would consider adding it.
If they don't, I'm in favour of a patch! :)

-- 
Pierre Neidhardt
https://ambrevar.xyz/


signature.asc
Description: PGP signature


bug#38498: Fontconfig does not find fonts in non-default profiles

2019-12-10 Thread Ludovic Courtès
Hello!

Pierre Neidhardt  skribis:

> We lose generality in making ~/.guix-profile special.

I think we all agree on that.  Fontconfig is one of the very few cases
where we ended up resorting to that.  The reason I think is simply that
Fontconfig honors ~/.config/fontconfig/fonts.xml but does not honor a
search path environment variable as is customary.

We could fix that by adding a patch so that Fontconfig would honor
$FONTCONFIG_FONT_PATH or similar.

WDYT?

Thanks,
Ludo’.





bug#38498: Fontconfig does not find fonts in non-default profiles

2019-12-06 Thread Alex Kost
Pierre Neidhardt (2019-12-05 18:52 +0100) wrote:

> Thank you Alex, that's what I did and it works.
>
> That said, I think it'd be nice if Guix would automatically do this for
> us.  After all, it already handles multiple-profiles properly for so
> many other things! :)

TBH I don't understand all the problems related to multiple-profiles
that were discussed and "solved" recently.  I have been using multiple
profiles for at least 5 years (I don't even have ~/.guix-profile on my
disk) and I have not had any serious problems, just some small obstacles
that can be easily overpassed.

Anyway, what I have written is not related to the bug, sorry for the
noise :-)

-- 
Alex





bug#38498: Fontconfig does not find fonts in non-default profiles

2019-12-05 Thread Alex Kost
Pierre Neidhardt (2019-12-05 11:43 +0100) wrote:

> The fontconfig package has this bit:
>
> (string-append "--with-add-fonts="
>   "~/.guix-profile/share/fonts,"
>   "/run/current-system/profile/share/fonts")
>
> If I understand correctly, fonts can only be installed at the system
> level or in ~/.guix-profile.
> Is there a way to install fonts in a non-default profile?

I install fonts into a special profile.  All you need to do is edit your
"~/.config/fontconfig/fonts.conf" file.  Mine looks like this:




~/.guix-profiles/fonts/fonts/share/fonts


This allows ‘fc-cache’ and similar commands to find fonts from a
non-standard directory.

-- 
Alex