[Fontconfig] Difficulty finding a font file through the libraries

Michael Brennen michael at fishnet.us
Fri Oct 29 05:06:32 UTC 2021


For what it is worth, adding this line to the end of /usr/share/ghostscript/Resource/Init/Fontmap.GS, gs does not go through the fc libraries and finds the font in the .ttf file.

/MoongladeDEMO-Regular  (/var/www/ext/resources/fonts/2- Moonglade Regular DEMO.ttf)  ;

   -- Michael

> On Oct 28, 2021, at 23:55, Michael Brennen <michael at fishnet.us> wrote:
> 
> apache has a nologin shell, so sudo -i does not work.
> 
> The client’s font directory path is in /etc/fonts/local.conf as a <dir>…</dir> parameter within <fontconfig>. That is how gs finds the mass of fonts they have.
> 
> How does fc relate the file name of the font to the font’s internal name? Perhaps that is not important, but I don’t know how to explain why gs only matches on the .ttf.orig file, while the fc tools (fc-*) match on the .ttf file. The two files are identical and return identical md5 sums, and the only difference between them is the name. Ownership and permissions are the same on both files.
> 
> The linked config files in /etc/fonts/conf.d don’t make much sense to me, and I don’t know if they have anything to do with this.
> 
> For what it is worth, a 4096 debug of fc-match on the .ttf file is below.
> 
> Again, thanks,
> 
>    -- Michael
> 
> # export FC_DEBUG=4096 ; fc-match MoongladeDemo
> 
> FC_DEBUG=4096
> Pattern has 24 elts (size 32), 24 elts (size 24)
>         family: "MoongladeDemo"(s) "DejaVu Sans"(w) "Bitstream Vera Sans"(w) … many more … "Nimbus Sans Narrow"(w) ->  "Moonglade DEMO"(w)
>         familylang: "en"(s) "en-us"(w) ->  "en"(w)
>         style: (None) ->  "Regular"(w)
>         stylelang: "en"(s) "en-us"(w) ->  "en"(w)
>         fullname: (None) ->  "Moonglade DEMO Regular"(w)
>         fullnamelang: "en"(s) "en-us"(w) ->  "en"(w)
>         slant: 0(i)(s) ->  0(i)(w)
>         weight: 80(i)(s) ->  80(f)(w)
>         width: 100(i)(s) ->  100(f)(w)
>         size: 12(f)(s) -> (None)
>         pixelsize: 12.5(f)(s) -> (None)
>         hintstyle: 1(i)(w) -> (None)
>         hinting: True(s) -> (None)
>         verticallayout: False(s) -> (None)
>         autohint: False(s) -> (None)
>         globaladvance: True(s) -> (None)
>         dpi: 75(f)(s) -> (None)
>         scale: 1(f)(s) -> (None)
>         foundry: (None) ->  "PfEd"(w)
>         file: (None) ->  "/var/www/ext/resources/fonts/2- Moonglade Regular DEMO.ttf"(w)
>         index: (None) ->  0(i)(w)
>         outline: (None) ->  True(w)
>         scalable: (None) ->  True(w)
>         charset: (None) ->
>         0000: 00000000 ffffffff ffffffff 7fffffff 00000000 8112c37e 3f7fffbf bffeffbf
>         0001: ffff7fff fef3cff3 fffbf3ff 7fffffff 00000000 00000000 00000000 00000000
>         0002: 00000000 00000000 00000000 00000000 00000000 00000000 3f0002c0 00000000
>         001e: 00000000 00000000 00000000 00000000 0000003f 00000000 00000000 00000000
>         0020: 30000000 00010040 00000000 00000000 00000000 00001000 00000000 00000000
>         0021: 00000000 00000004 00000000 00000000 00000000 00000000 00000000 00000000
> (w)
>         lang: "en"(w) ->  aa|af|ay|bi|br|bs|ca|ch|en|  …  |sg|sn|su|za(w)
>         fontversion: 2147483647(i)(s) ->  65536(i)(w)
>         embeddedbitmap: True(s) -> (None)
>         capability: (None) ->  "otlayout:DFLT"(w)
>         fontformat: (None) ->  "TrueType"(w)
>         decorative: False(s) ->  False(w)
>         namelang: "en"(s) -> (None)
>         prgname: "fc-match"(s) -> (None)
>         postscriptname: (None) ->  "MoongladeDEMO-Regular"(w)
>         color: (None) ->  False(w)
>         symbol: False(s) ->  False(w)
>         variable: False(s) ->  False(w)
> 2- Moonglade Regular DEMO.ttf: "Moonglade DEMO" "Regular"
> 
>> On Oct 28, 2021, at 20:07, Lawrence D'Oliveiro <ldo at geek-central.gen.nz <mailto:ldo at geek-central.gen.nz>> wrote:
>> 
>> On Thu, 28 Oct 2021 19:43:45 -0500, Michael Brennen wrote:
>> 
>>> 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.
>> 
>> sudo also has the -i/--login option to make sure you run the command
>> more like a real login session as that user; may be worth adding that,
>> just in case.
>> 
>>> Loading MoongladeDEMO-Regular font from
>>> /var/www/ext/resources/fonts/2- Moonglade Regular DEMO.ttf.orig...
>> 
>> By the way, there must be an entry in the Fontconfig setup somewhere
>> that says to look in /var/www/ext/resources/fonts for fonts ... or is
>> this in the aforementioned Fontmap file?
> 

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


More information about the Fontconfig mailing list