为什么Ghostscript无法识别我修改过的“ cidfmap”文件?

时间:2019-04-16 20:01:48

标签: ghostscript

我正在尝试使用Windows 10 Pro上的Ghostscript 9.27通过修改后的'cidfmap'文件($ GS_HOME / Resource / Init / cidfmap)压缩具有CID字体的PDF。但是,Ghostscript似乎无法识别我对'cidfmap'的更改,而是想加载DroidSansFallback TrueType字体来模拟缺少的CID字体。

我已经尝试使用“ -I”命令行参数来告诉Ghostscript使用文档中指定的$ GS_HOME / Resource / Init目录中的修改文件。

我还尝试使用以下命令(且无错误)在VS 2017的开发人员命令提示符中构建源代码:

nmake /A psi/msvc.mak MSVC_VERSION=15 WIN64=

下面是我在命令提示符下运行的完整Ghostscript命令:

gswin64c.exe -I"C:/Program Files/gs/ghostscript-9.27/Resource/Init" -sDEVICE=pdfwrite -dPDFSETTINGS=/printer -dPDFSTOPONERROR -dBATCH -dNOPAUSE -sOutputFile=output.pdf m0001-062-1.pdf

将记录添加到“ cidfmap”文件中(这是唯一的记录):

/MSPGothic << /FileType /TrueType /Path ("C:/Windows/Fonts/msgothic.ttc") /SubfontID 0 /CSI [(Japan1) 2] >> ;

和我在两种情况下都收到的Ghostscript的输出:

GPL Ghostscript 9.27 (2019-04-04)
Copyright (C) 2018 Artifex Software, Inc.  All rights reserved.
This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
see the file COPYING for details.
Processing pages 1 through 4.
Page 1
Loading NimbusRoman-Bold font from C:/Program Files/gs/ghostscript-9.27/Resource/Font/NimbusRoman-Bold... 4570288 3226611 4074256 2336262 4 done.
Page 2
Page 3
Querying operating system for font files...
Substituting font Helvetica for ArialMT.
Loading NimbusSans-Regular font from C:/Program Files/gs/ghostscript-9.27/Resource/Font/NimbusSans-Regular... 5086792 3742157 2284000 967988 4 done.
Substituting font Helvetica-Narrow for ArialNarrow.
Loading NimbusSansNarrow-Regular font from C:/Program Files/gs/ghostscript-9.27/Resource/Font/NimbusSansNarrow-Regular... 5273304 3930300 2397536 1064531 4 done.
Substituting font Helvetica-Bold for Arial-BoldMT.
Loading NimbusSans-Bold font from C:/Program Files/gs/ghostscript-9.27/Resource/Font/NimbusSans-Bold... 5500440 4150230 3021540 1680111 4 done.
Can't find CID font "MSPGothic".
Attempting to substitute CID font /Adobe-Japan1 for /MSPGothic, see doc/Use.htm#CIDFontSubstitution.
The substitute CID font "Adobe-Japan1" is not provided either. attempting to use fallback CIDFont.See doc/Use.htm#CIDFontSubstitution.
Loading a TT font from C:/Program Files/gs/ghostscript-9.27/Resource/CIDFSubst/DroidSansFallback.ttf to emulate a CID font Adobe-Japan1 ... Done.
Page 4
Can't find CID font "MSPGothic".
Attempting to substitute CID font /Adobe-Japan1 for /MSPGothic, see doc/Use.htm#CIDFontSubstitution.
Loading a TT font from C:/Program Files/gs/ghostscript-9.27/Resource/CIDFSubst/DroidSansFallback.ttf to emulate a CID font Adobe-Japan1 ... Done.

似乎我在这里错过了一些简单的事情,因为其他有类似问题的人只使用“ -I”命令行参数就可以了。

我在做什么错了?

1 个答案:

答案 0 :(得分:0)

问题很明显(一旦我仔细看过!)。您已经在文件名前后加上了引号“”。

'('和')'字符是PostScript中的字符串定界符,而不是“(并且cidfmap文件作为PostScript程序读取),因此,您已将”“字符作为路径的一部分。毫不奇怪,Ghostscript找不到以“

开头的路径

因此,如果您将cidfmap条目更改为:

/MSPGothic << /FileType /TrueType /Path (C:/Windows/Fonts/msgothic.ttc) /SubfontID 0 /CSI [(Japan1) 2] >> ;

您应该发现它对我有用。