Success eventually, after tidying things up and removing redundant directories. To summarize from all doktor5000's hints and tips, using my own system as an example where the additional fonts needed to be available to ghostscript for printing encapsulated postscript files:
Create local directory, e.g. /home/<user>/localfonts
Populate that with the Type1 font files, then create Fontmap
- Code: Select all
$ cd ~/localfonts
$ sudo type1inst
Use fontconfig to create the font cache for the additional fonts
- Code: Select all
$ sudo fc-cache ~/localfonts
Ghostscript needs at least one environment variable to use the new directory:
I set the following three to be sure, writing them into my .tcshrc file.
- Code: Select all
setenv GS_LIB /home/lcl/localfonts
setenv GS_FONTMAP /home/lcl/localfonts/Fontmap
setenv GS_FONTPATH /home/lcl/localfonts
To check that the search path has been augmented for Ghostscript run e.g.
- Code: Select all
$ gs -h | grep localfonts
There should be an entry at the head of the list of search paths matching `echo ${GS_LIB}` or `printenv GS_LIB`.
The next step is to update the fontconfig configuration files in /etc/fonts.
In my case the localfonts XML file was called 01-local.conf. You should use any prefix in the range 0[1] to 0[9].
The standard procedure is to place this config file in conf.avail and then create a symlink in conf.d (as root):
- Code: Select all
$ ln -s ../conf.avail/01-local.conf 01-local.conf
- Code: Select all
$ cat 01-local.conf
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "../fonts.dtd">
<fontconfig>
<!-- Font directory list -->
<dir>/home/lcl/localfonts</dir>
</fontconfig>
fontconfig is quite fragile. You may encounter frequent system freezes if you make any changes to directories already processed for its cache. Beware in particular of the /usr/share/fonts tree and also the user's .local/share/fonts, if it exists, which is scanned periodically by default by fontconfig.
Once the preceding steps have been taken, run
- Code: Select all
$ fc-list | grep localfonts
as user to confirm that fontconfig finds the new directory. `fc-cache -v` can be used in the same way to find out the status of the fonts in the cache.
e.g. /home/lcl/localfonts: skipping, existing cache is valid: 186 fonts, 0 dirs
The command
- Code: Select all
$ gs somefile.ps
displays a page and on the terminal shows from where ghostscript loads the font files and how it interprets them; sometimes you will see aliases and sometimes substitutions if the font is not on the system.
Ecco:
- Code: Select all
$ gs abc-0.ps
GPL Ghostscript 9.14 (2014-03-26)
Copyright (C) 2014 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Loading AlienEncounters font from /home/lcl/localfonts/ALIEE___.pfb... 3823168 2273950 3995072 2613458 3 done.
Loading AlienEncountersSolid font from /home/lcl/localfonts/ALIEES__.pfb... 3851784 2364635 4035440 2620465 3 done.
Loading AlienLeague font from /home/lcl/localfonts/ALIEN5.pfb... 3814736 2277797 4075808 2629151 3 done.
Scanning /home/lcl/localfonts for fonts... 377 files, 98 scanned, 0 new fonts.
Can't find (or can't open) font file /usr/share/ghostscript/9.14/Resource/Font/AlmonteWoodgrain-Italic.
Can't find (or can't open) font file AlmonteWoodgrain-Italic.
Querying operating system for font files...
**** 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.
**** Warning: glyf overlaps cmap, truncating.
Can't find (or can't open) font file /usr/share/ghostscript/9.14/Resource/Font/AlmonteWoodgrain-Italic.
Can't find (or can't open) font file AlmonteWoodgrain-Italic.
Didn't find this font on the system!
Substituting font Helvetica-Oblique for AlmonteWoodgrain-Italic.
Loading NimbusSanL-ReguItal font from /usr/share/fonts/default/Type1/adobestd35/n019023l.pfb... 4112264 2647598 6094208 3054066 3 done.
Loading AndaleMono font from /home/lcl/localfonts/andalemo.pfb... 4301320 2760415 6094208 3046133 3 done.
Loading Angelica font from /home/lcl/localfonts/angelica.pfb... 4272640 2831233 6094208 3047741 3 done.
Loading Anklepants font from /home/lcl/localfonts/anklepan.pfb... 4361808 2936453 6094208 3049573 3 done.
Loading AppleGaramond font from /home/lcl/localfonts/Apple_Garamond.pfb... 4490480 3076354 6094208 3051411 3 done.
Loading Ardour3DGM font from /home/lcl/localfonts/ardour3d.pfb... 4685152 3264696 6094208 3053237 3 done.
Loading NimbusSanL-Regu font from /usr/share/fonts/default/Type1/n019003l.pfb... 4849040 3407251 6111136 3079619 3 done.
Can't find (or can't open) font file /usr/share/ghostscript/9.14/Resource/Font/ArialBlack.
Can't find (or can't open) font file ArialBlack.
Didn't find this font on the system!
Substituting font Helvetica-Bold for ArialBlack.
Loading NimbusSanL-Bold font from /usr/share/fonts/default/Type1/n019004l.pfb... 5323832 3828862 6144448 3218168 3 done.
Can't find (or can't open) font file /usr/share/ghostscript/9.14/Resource/Font/Ariston-Italic.
Can't find (or can't open) font file Ariston-Italic.
Didn't find this font on the system!
Substituting font Helvetica-Oblique for Ariston-Italic.
Loading BastardusSans font from /home/lcl/localfonts/BastardusSans.pfb... 5137480 3645032 6094208 3062426 3 done.
Loading Belmar-Condensed-Normal font from /home/lcl/localfonts/Belmar-Condensed-Normal.pfb... 5324088 3870955 6111136 3194031 3 done.
Loading BetaDance font from /usr/share/fonts/default/ghostscript/betadance.pfa... 5593824 4113915 6111136 3317128 3 done.
Loading CharterBT-Roman font from /home/lcl/localfonts/bchr.pfa... 5849704 4332919 6111136 3441665 3 done.
Loading BitstreamVeraSerif-Roman font from /home/lcl/localfonts/VeraSe.pfb... 6158080 4600853 6128064 3572900 3 done.
Loading BlueHighway font from /usr/share/fonts/ttf/western/Bluehigh.ttf... 6158080 4603619 6217368 3933035 3 done.
Can't find (or can't open) font file /usr/share/ghostscript/9.14/Resource/Font/BlueHighwayCondensed-Bold.
Can't find (or can't open) font file BlueHighwayCondensed-Bold.
Didn't find this font on the system!
Substituting font Helvetica-Narrow-Bold for BlueHighwayCondensed-Bold.
Loading NimbusSanL-BoldCond font from /usr/share/fonts/default/Type1/adobestd35/n019044l.pfb... 6438808 4865190 6217368 3943426 3 done.
Loading BorzoiRegular font from /home/lcl/localfonts/BorzoiRegular.pfb... 7030216 5379088 6250680 4079126 3 done.
Can't find (or can't open) font file /usr/share/ghostscript/9.14/Resource/Font/Callistroke-Italic.
Can't find (or can't open) font file Callistroke-Italic.
Didn't find this font on the system!
Substituting font Helvetica-Oblique for Callistroke-Italic.
>>showpage, press <return> to continue<<
GS>quit
Many thanks to the indefatigable doktor5000 and apologies for labouring the point.