[Fontconfig] Difficulty finding a font file through the libraries

Michael Brennen michael at fishnet.us
Sun Oct 31 05:46:29 UTC 2021


I now understand both why gs is not printing FC debug messages and why it is not matching the same fonts that fc-match does.

I downloaded the Centos 7 ghostscript source package tonight and found that the only part of fontconfig that it uses is the subset of routines to collect the names of fonts available. It adds the FC font list to its own set of fonts, and it then does its own font searching and matching.

So the font matching problem is somewhere in gs, not fontconfig. Thanks for the responses; I hope knowing that gs’s use of fontconfig is limited comes in useful.

   -- Michael

> On Oct 30, 2021, at 12:28, Michael Brennen <michael at fishnet.us> wrote:
> 
>> On Oct 30, 2021, at 12:13, Michael Brennen <michael at fishnet.us <mailto:michael at fishnet.us>> wrote:
>> 
>>> On Oct 29, 2021, at 03:34, Lawrence D'Oliveiro <ldo at geek-central.gen.nz <mailto:ldo at geek-central.gen.nz>> wrote:
>>> 
>>> On Fri, 29 Oct 2021 01:56:45 -0500, Michael Brennen wrote:
>>> 
>>> Yes. And we need to do this while reproducing the problem--that is,
>>> running Ghostscript and watching it fail to find the .ttf file and use
>>> .ttf.orig instead. Looking at the FC_DEBUG flags, it may be worthwhile
>>> turning on just about everything (FC_DEBUG=8191). You may end up with a
>>> huge logfile, but at least you can search through it to see where the
>>> .ttf.orig name is coming from.
> 
> 
> Responding to my own post below, one obvious answer to my question is that FcFontSetMatchInternal() is not called. My perusing the source was fairly quick, and this is the first time I’ve looked at it; perhaps I am missing the overall flow of the FC code. Even if that is the case, why is there no debug info printed at all? I would expect something to be printed besides setting FC_DEBUG=2.
> 
> Thanks for any insight,
> 
>    -- Michael
> 
> 
>> Glancing briefly over the source, it appears that FcFontSetMatchInternal() should be printing significant debug information when FC_DEBUG=2 (=FC_DBG_MATCHV), but it is not.
>> 
>> I am running gs as follows:
>> 
>> ================================
>> export FC_DEBUG=2
>> /usr/bin/gs -dNOPAUSE -sDEVICE=jpeg -dJPEGQ=100 -r288 -dDownScaleFactor=4 -sOutputFile=file-q-%02d.jpg "source.ai" -dBATCH >fc_gs_log 2>&1
>> ================================
>> 
>> 
>> The contents of fc_gs_log are as follows. FC_DEBUG is set to 2, but there is no debug information. Does anyone have an idea why the extensive debug info is missing? I think I need to see that to understand why the .ttf file is being skipped. Thanks much….
>> 
>> 
>> ================================
>> GPL Ghostscript 9.25 (2018-09-13)
>> Copyright (C) 2018 Artifex Software, Inc.  All rights reserved.
>> This software comes with NO WARRANTY: see the file PUBLIC for details.
>> Processing pages 1 through 2.
>> Page 1
>> Querying operating system for font files...
>> DEBUG: FC_WEIGHT didn't match
>> FC_DEBUG=2
>> **** 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 12161916 2847020 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.
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/fontconfig/attachments/20211031/77915cce/attachment-0001.htm>


More information about the Fontconfig mailing list