<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div>On Oct 29, 2021, at 00:49, Lawrence D'Oliveiro <<a href="mailto:ldo@geek-central.gen.nz" class="">ldo@geek-central.gen.nz</a>> wrote:<br class=""><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class=""><div class="">On Fri, 29 Oct 2021 00:06:32 -0500, Michael Brennen wrote:<br class=""><br class=""><blockquote type="cite" class="">For what it is worth, adding this line to the end of<br class="">/usr/share/ghostscript/Resource/Init/Fontmap.GS, gs does not go<br class="">through the fc libraries and finds the font in the .ttf file.<br class=""><br class="">/MoongladeDEMO-Regular  (/var/www/ext/resources/fonts/2- Moonglade Regular DEMO.ttf)  ;<br class=""></blockquote><br class="">OK, I figured out on my Debian system the equivalent file is<br class="">/usr/share/ghostscript/9.54.0/Resource/Init/Fontmap.GS. I think that’s<br class="">just for the builtin fonts, and shouldn’t be edited; this is because<br class="">your changes could easily be lost the next time the package is upgraded<br class="">or reinstalled.<br class=""><br class="">So where is the equivalent to /var/lib/ghostscript/fonts/Fontmap? And<br class="">is it automatically generated in turn from config files in /etc<br class="">somewhere?<br class=""></div></div></blockquote></div><br class=""><div class="">I know better than to touch the /usr/share stuff for the long run; this is quick get to the point testing. :)</div><div class=""><br class=""></div><div class="">Running the process as follows gives the same results. It finds the font in the .ttf.orig file.<div class=""><br class=""></div><div class=""># sudo -u apache /usr/bin/gs ….<br class=""><div class=""><br class=""></div><div class="">The Fontmap file is /usr/share/ghostscript/Resource/Init/Fontmap; it has four lines in it that refer back to the Fontmap.GS file. I have not spent much time looking for an alternate gs configuration file under /etc, but so far I have not found one; besides, that is ancillary to the real problem.</div><div class=""><br class=""></div><div class="">======================================================</div><div class=""><div class="">%!</div><div class="">% See Fontmap.GS for the syntax of real Fontmap files.</div><div class="">%% Replace 1 (Fontmap.GS)</div><div class="">(Fontmap.GS) .runlibfile</div></div><div class=""><div class="">======================================================</div><div class=""></div></div><div class=""><br class=""></div><div class="">So if I comment the font directory path in /etc/fonts/local.conf and then run this script file as "sudo -u apache ./run_gs” (which I think should closely approximate php running the script as the apache user)</div><div class=""><br class=""></div><div class=""><div class=""><font face="Courier" class="">#!/bin/bash</font></div><div class=""><font face="Courier" class="">export GS_FONTPATH=/var/www/ext/resources/fonts</font></div><div class=""><font face="Courier" class="">time /usr/bin/gs ...</font></div></div><div class=""><br class=""></div><div class=""><div class=""><font face="Courier" class="">Processing pages 1 through 2.</font></div><div class=""><font face="Courier" class="">Page 1</font></div><div class=""><font face="Courier" class="">Scanning /var/www/ext/resources/fonts for fonts...**** Warning: glyf overlaps cmap, truncating.</font></div><div class=""><font face="Courier" class="">**** Warning: glyf overlaps cmap, truncating.</font></div><div class=""><font face="Courier" class="">…</font></div><div class=""><font face="Courier" class=""> 8859 files, 8358 scanned, 7393 new fonts.</font></div><div class=""><font face="Courier" class="">Can't find (or can't open) font file /usr/share/ghostscript/Resource/Font/MoongladeDEMO-Regular.</font></div><div class=""><font face="Courier" class="">Can't find (or can't open) font file MoongladeDEMO-Regular.</font></div><div class=""><font face="Courier" class="">Loading MoongladeDEMO-Regular font from /var/www/ext/resources/fonts/2- Moonglade Regular DEMO.ttf... 30637720 23902546 2708316 1039805 3 done.</font></div></div><div class=""><br class="webkit-block-placeholder"></div><div class=""><br class=""></div><div class="">it finds the font in the .ttf file, NOT the .ttf.orig file. The difference is that in this configuration gs does not go through FC to find the fonts.</div><div class=""><br class=""></div><div class="">Regarding the XML documentation, I have read that, but the XML syntax is not the difficulty sorting out the linked config files in /etc/fonts/conf.d. The difficulty is that there is a *lot* going on in those files, and trying to gain some idea of what they do is not trivial.</div><div class=""><br class=""></div><div class="">Besides, I doubt that they have anything to do with gs not being able to find the font in the .ttf file when it searches through FC. Or do you think the preset config files have anything to do with this? I genuinely do not know.</div><div class=""><br class=""></div><div class="">So as I see the question is still open why gs searching through FC does not find the font in the proper file, but when gs searches the fonts directly it successfully finds it. Does the name have anything to do with this? That is why I wondered about the configuration presets in /etc/fonts/conf.d, not knowing if they might have anything to do with the name format.</div><div class=""><br class=""></div><div class="">Again, thanks for your patience.</div><div class=""><br class="webkit-block-placeholder"></div><div class="">   -- Michael</div></div></div><div class=""><br class=""></div></body></html>