Reputation: 71
How can I get Ghostscript to substitute Arial/Arial-Bold for Arial+000040/Arial,Bold+000041 when reading jhtest.pdf?
Ghostscript insists on substituting Helvetica-Bold for both fonts. Changing the font name in the pdf using vim in binary mode helps - jhtest-patched.pdf
Log for jhtest.pdf
GS_FONTPATH=C:\Windows\Fonts
gs -dNOPAUSE -dBATCH -dCCFONTDEBUG -sDEVICE=nullpage jhtest.pdf
GPL Ghostscript 9.18 (2015-10-05)
Copyright (C) 2015 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
Scanning C:\windows\Fonts for fonts... 666 files, 473 scanned, 447 new fonts.
Querying operating system for font files...
Substituting font Helvetica-Bold for Arial+000040.
Loading NimbusSanL-Bol font from %rom%Resource/Font/NimbusSanL-Bol... 8611036 7144230 2673392 1348904 3 done.
Substituting font Helvetica-Bold for Arial,Bold+000041.
Substituting font Times-Bold for TimesNewRoman,Bold+000013.
Loading NimbusRomNo9L-Med font from %rom%Resource/Font/NimbusRomNo9L-Med... 8870100 7399404 3366000 1964135 3 done.
Log for jhtest-patched.pdf - Arial and Arial-Bold are substituted as expected.
GS_FONTPATH=C:\Windows\Fonts
gs -dNOPAUSE -dBATCH -dCCFONTDEBUG -sDEVICE=nullpage jhtest-patched.pdf
GPL Ghostscript 9.18 (2015-10-05)
Copyright (C) 2015 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
Can't find (or can't open) font file %rom%Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Can't find (or can't open) font file %rom%Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Scanning C:\windows\Fonts for fonts... 666 files, 473 scanned, 447 new fonts.
Can't find (or can't open) font file %rom%Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Loading ArialMT font from C:\windows\Fonts/arial.ttf... 8312100 3435413 4127492 2703302 3 done.
Can't find (or can't open) font file %rom%Resource/Font/Arial-BoldMT.
Can't find (or can't open) font file Arial-BoldMT.
Loading Arial-BoldMT font from C:\windows\Fonts/arialbd.ttf... 8369364 3483445 6172560 4696464 3 done.
Querying operating system for font files...
Substituting font Times-Bold for TimesNewRoman,Bold+000013.
Loading NimbusRomNo9L-Med font from %rom%Resource/Font/NimbusRomNo9L-Med... 8413932 3678215 7135440 5602384 3 done.
Upvotes: 1
Views: 3900
Reputation: 31139
This looks like an attempt by the creating software to include a subset font (subset fonts are normally named with a 6 letter 'tag' a plus sign and then the original font name). However this isn't (obviously) a font corresponding to that scheme.
The fonts are not embedded, whihc is frankly a bad idea, and the names are non-standard. This means that the PDF consumer must use a substitute font. The default substitute font for Ghostscript is Helvetica, which is why you get that.
If you change the fontnames to match the 'real' font name, then Ghostscript (and other PDF consumers) are able to find Arial as a substitute.
In order to get Ghostscript to find the 'mangled' names in your file, you would have to specifically define a substitute for those exact font names.
Since you are using Windows your build is using a ROM file system. However, to complicate matters, you seem o be using a Linux version of Ghostscript (gs instead of gswin32 or gswin64).
This makes me unsure what exactly you are doing. However, if I get the Ghostscript source, modify the file /ghostpdl/Resource/Init/fontmap.GS:
/Arial+000040 /ArialMT ;
and then run Ghostscript:
gswin32c -I/ghostpdl/Resource/Init jhtest.pdf
the result is that Arial is used for Arial+000040. You will need to modify this to suit your environment, and you will need to locate the resource files appropriate to the version of Ghostscript which you are using (because they are versioned).
You can then add as many substitutes as you like.
Or you can get 'Visual Software' to produce more sensible PDF file which have the font embedded. Or faling that at least don't mangle the font names.
Upvotes: 2