wayneh
wayneh

Reputation: 4413

Stop Ghostscript from replacing embedded fonts?

Using Ghostscript 9.19, Windows 10 Pro

I am using Ghostscript to convert an existing PDF to PDF/A-1b.

However, even though the required fonts are already embedded in my original PDF, Ghostscript is substituting them in the output PDF/A file.

Specifically: Substituting font Times-Bold for Times New Roman,Bold. Substituting font Times-Roman for Times New Roman. Substituting font Times-Italic for Times New Roman,Italic.

I have Times New Roman installed on my machine (it's there by default).

Here's my command line:

C:\Program Files\gs\gs9.19\bin>gswin64c -dPDFA -dBATCH -dNOPAUSE 
 -sProcessColorModel=DeviceCMYK -sDEVICE=pdfwrite 
 -sPDFACompatibilityPolicy=1 -sFontPath=C:/Windows/Fonts 
  -IC:/windows/fonts -sOutputFile=C:/temp/testerA.pdf c:/temp/tester.pdf

BEFORE processing with Gjostscript: enter image description here

AFTER processing with Ghostscript: enter image description here

Why is Ghostscript substituting an embedded font?

How can I prevent Ghostscript from substituting embedded fonts?

EDIT: Screenshot of the Times font from my system showing that the name matches the embedded name in the PDF:

enter image description here

Upvotes: 1

Views: 3466

Answers (1)

KenS
KenS

Reputation: 31199

Well the basic answer here is simply that the fonts are not embedded in the first place.

Looking at the original font list we see:

Times New Roman
Actual Font: TimesNewRomanPSMT

Which is not the same font. Similarly Times New Roman,Italic is not the same font as TimesNewRomanPS-ItalicMT etc.

Having TimesNewRomanPSMT on your machine, and having -sFontPath set to point to that directory, means that should you have input which uses a font called 'TimesNewRomanPSMT' but does not embed it, then Ghostscript will use the TrueType font from disk, because it has the same name.

"Times New Roman" is not the same name as "TimesNewRomanPSMT", so Ghostscript won't use TimesNewRomanPSMT as a replacement for Time New Roman, instead it uses its built in fonts and decides the closest match it has to Times New Roman is Times, which seems entirely reasonable to me.

You can define substitutions yourself, so if you want to use TimesNewRomanPSMT as a substitute for Times New Roman, you can do so. You just need to edit fontmap.GS.

But fundamentally Ghostscript is not replacing embedded fonts, because the fonts are not embedded. Note that its a requirement of PDF/A that all fonts be embedded, so the pdfwrite device isn't even able to leave the fonts non-embedded as they are, it must embed something.

Upvotes: 2

Related Questions