Ghostscript relies on the GS_FONTPATH environment variable to locate its fonts. However, some font packages (perhaps most) do not configure GS_FONTPATH and so installed fonts are not found by ghostscript without manual configuration by the user. The attached patches configure GS_FONTPATH for three font packages: media-fonts/corefonts media-fonts/freefonts media-fonts/urw-fonts (I don't have anything against the other font packages. It's just that these are the ones I currently use.) Additionally, a patch is required to env-update in /usr/lib/portage/pym/portage.py to recognize GS_FONTPATH as a "special" that may accumulate colon-separated paths. (Without env-update patched, GS_FONTPATH will merely take the last assigned value.) Reproducible: Always Steps to Reproduce:
Created attachment 25165 [details, diff] Patches corefonts-1-r1.ebuild Patches corefonts-1-r1.ebuild to assign GS_FONTPATH in /etc/env.d/40gs-corefonts
Created attachment 25166 [details, diff] Patches freefonts-0.10-r2.ebuild Patches freefonts-0.10-r2.ebuild to assign GS_FONTPATH in /etc/env.d/40gs-freefonts
Created attachment 25167 [details, diff] Patches urw-fonts-2.0-r1.ebuild Patches urw-fonts-2.0-r1.ebuild to assign GS_FONTPATH in /etc/env.d/40gs-urw-fonts
Created attachment 25168 [details, diff] Patches env-update Patches env-update in /usr/lib/portage/pym/portage.py by adding GS_FONTPATH to the list of "special" environment variables which accumulate colon separated paths.
Ghostscript apparently isn't smart enough to use fontconfig?
Apparently. I'm no expert on either, but I did find mention in the FontConfig newsgroup as to the reason: the information FontConfig caches and provides does not include the font's PostScript name. Refer to http://www.xfree86.org/pipermail/forum/2003-April/001114.html Now that you mention it, it would be nice if ghostscript used FontConfig. CUPS and OpenOffice, too. I'm using an inkjet printer with no built-in fonts, and it would simplify matters if OO, CUPS, and Ghostscript all agreed on which fonts I have built into my system. I'm dreaming. I used to use a Mac. But maybe FontConfig could get us there.
A solution that I've found after some hours of searching is adding the FontConfig path (/etc/fonts) to the environment variable GS_LIB. Now ghostscript seems to work together with fontconfig (although I'm no expert in these things) and recognizes fonts in the Fontmap file.
The fix suggested in Comment #7 did not work for me. This is what I did. Please tell me if I missed something. $ unset GS_FONTPATH $ export GS_LIB=/etc/fonts $ cd /usr/share/ghostscript/7.07/lib $ gs prfont.ps GS>/Becker DoFont ("Becker" is a Type 1 font in /usr/share/fonts/freefont) Result: Can't find (or can't open) font file /usr/share/ghostscript/fonts/Becker. Can't find (or can't open) font file Becker. Substituting font Courier for Becker. Ghostscript then displays the character map for Courier. With /usr/share/fonts/freefont added to GS_FONTPATH, the prfont script correctly displays the character map for the Becker font. I am using app-text/ghostscript-7.07.1-r1, compiled with USE Flags: X cups -cjk
Redhat patched ESP ghostscript 7.0.7 for fontconfig. Take a look at: http://cvs.sourceforge.net/viewcvs.py/kde-redhat/fedora/SOURCES/ghostscript-7.07-fontconfig-rh-2.patch?rev=1.3&view=auto ...I had to switch to AFPL because ESP was crashing during pstopdf conversions. But I'm having the font problem as well.
added the redhat patch to ghostscript-7.07.1-r4
you also need to add a pkgcongfig buildtime dep I wonder why this is behind a truetype useflag btw ?
added the pkgconfig dep. i used the truetype useflag because that's what fontconfig does, adds support for truetype fonts, doesn't it? (next time please reopen the bug)
not really, fontconfig is just a way to easily select/handle fonts & it happens to depend on freetype which supports a whole range of font formats (not just ttf). In practice i believe this patch -if used- should be applied unconditionally to the ebuild, this would be better for the overall consistenty of how gentoo handles fonts (that is what comment #5 was about). The ghostscript fonts should also be moved to the /usr/share/fonts location eventually.
i added a new revision that applies the fontconfig patch by default and moves the fonts to /usr/share/fonts/ghostscript