[Fontconfig] Difficulty finding a font file through the libraries

Michael Brennen michael at fishnet.us
Fri Oct 29 00:43:45 UTC 2021


Thanks very much for the response. I had in mind to add that this is on a CentOS 7 system, but was focused on getting other details right and forgot.

The production script runs as apache; there is no local fontconfig directory. I ran the process with sudo -u apache, and it has the same result: the font is found in the .ttf.orig file.

fc-match running as either root or apache finds the font in both files, and it lists the .ttf file first.

The gs output follows; perhaps someone will see something useful.

Querying operating system for font files...
DEBUG: FC_WEIGHT didn't match
**** Warning: glyf overlaps cmap, truncating.
**** Warning: glyf overlaps cmap, truncating.
**** Warning: glyf overlaps cmap, truncating.
**** Warning: glyf overlaps cmap, truncating.
**** Warning: glyf overlaps cmap, truncating.
Can't find (or can't open) font file /usr/share/ghostscript/Resource/Font/MoongladeDEMO-Regular.
Can't find (or can't open) font file MoongladeDEMO-Regular.
Loading MoongladeDEMO-Regular font from /var/www/ext/resources/fonts/2- Moonglade Regular DEMO.ttf.orig... 4484276 3144792 14104520 12372058 3 done.
Page 2
Can't find (or can't open) font file /usr/share/ghostscript/Resource/Font/MoongladeDEMO-Regular.
Can't find (or can't open) font file MoongladeDEMO-Regular.
Loading MoongladeDEMO-Regular font from /var/www/ext/resources/fonts/2- Moonglade Regular DEMO.ttf.orig... 4765108 3344760 2344716 1014065 3 done.

I will be happy to provide other info or run tests as needed. I don’t know how fontconfig relates file names to font names, so I am not sure where to look.

   -- Michael

> On Oct 28, 2021, at 18:31, Lawrence D'Oliveiro <ldo at geek-central.gen.nz> wrote:
> 
> I wrote:
> 
>> I don’t think Ghostscript uses Fontconfig. When I do “apt showpkg
>> ghostscript” on my Debian system, there is no sign of libfontconfig1
>> in its dependencies, as is present for example for Inkscape.
> 
> On the other hand, when I run “gs --help”, in the usage summary it
> reports “Ghostscript is also using fontconfig to search for font files”.
> 
>> This page <https://ghostscript.com/doc/current/Fonts.htm> describes
>> how Ghostscript finds its fonts. I can find no mention of Fontconfig
>> there. Instead, you have to manage a “Fontmap” file.
>> 
>> Looking at my installed Ghostscript package under Debian, I see a
>> directory called “/etc/ghostscript/fontmap.d/”. I think this is where
>> you place Fontmap-type files.
> 
> Ah, turns out the “Fontmap” file is located in
> /var/lib/ghostscript/fonts/, and Debian provides a
> /usr/sbin/update-gsfontmap script to regenerate that from the contents
> of the fontmap.d directory.
> 
>> Is there a per-user directory as well? Don’t know ...
> 
> Not for (re)generating the Fontmap, but there is for Fontconfig.
> 
> Are you running the Fontconfig tools as the same user as Ghostscript?
> Just to be sure they are looking at the same config ...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/fontconfig/attachments/20211028/044ab866/attachment.htm>


More information about the Fontconfig mailing list