获取此信息最可靠的方法是直接运行 Ghostscript 并查看其输出。
我说要“直接”运行它,因为 ImageMagick 在处理 EPS 输入时无论如何都会运行它。 (ImageMagick 无法使用 EPS、PS 或 PDF 输入——因此它利用 Ghostscript 作为其 delegate 来生成初始图像光栅数据,然后它会接管这些数据进一步处理)。
例如,您可以这样做(命令语法适用于 Linux、Unix 或 Mac OS X):
gs -o /dev/null -sDEVICE=pdfwrite unembedded-font-used.eps
在 Windows 上你可以这样运行它:
gswin64c.exe -o nul -sDEVICE=pdfwrite unembedded-font-used.eps
例如,Ghostscript 然后会在终端中报告此输出。这里是第一行:
GPL Ghostscript GIT PRERELEASE 9.18 (2015-04-07)
Copyright (C) 2015 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
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.
Querying operating system for font files...
现在下一行,如果没有找到“足够好”的替代字体:
Error: /typecheck in /findfont
Operand stack:
Arial
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- 1919 1 3 %oparray_pop
Dictionary stack:
--dict:1190/1684(ro)(G)-- --dict:0/20(G)-- --dict:78/200(L)--
Current allocation mode is local
GPL Ghostscript GIT PRERELEASE 9.18: Unrecoverable error, exit code 1
如果 Ghostscript 找到一种字体来代替缺失的字体,第二部分看起来有点不同:
Loading NimbusSanL-Reg font from %rom%Resource/Font/NimbusSanL-Reg... 4674144 3087974 1934432 636034 1 done.
可能有多个这样的行。您将能够准确地看到 Ghostscript 将使用哪个字体文件。在上述情况下,它将使用内置在其可执行文件中的字体,这由输出的%rom% 部分指示。如果在本地磁盘上找到字体,它将告诉完整路径。
请注意一个额外的细节:上述输出的一部分将针对<stdin>,另一部分针对<stdout>。在上面的示例中,它们全部混合在一起,因为我从终端复制了它。如果您只想看到<stderr>,则必须根据需要自行采取适当的措施。
当然,您也可以直接使用 Ghostscript 生成最终的 PNG、TIFF 或 JPEG 输出。也就是说,除非您之后需要 ImageMagick 进行更复杂的处理。