无法让 Ghostscript 使用 OpenType 字体

Posted

技术标签:

【中文标题】无法让 Ghostscript 使用 OpenType 字体【英文标题】:Can't get Ghostscript to use OpenType fonts 【发布时间】:2019-12-07 14:19:07 【问题描述】:

我正在尝试在 Windows 上使用 GhostScript 9.27 将一些 PDF 文件转换为 PDF/A 文件。但是,安装的字体会被 Helvetica 替换,即使它应该在系统的字体目录中可用。

这是调试输出的相关部分:

%Resolving: [7 0]
resmp ResourceStatus beg /RotisSansSerifStd-Regular
cidcm GetCIDSystemInfo beg
resmp ResourceStatus beg /RotisSansSerifStd
resmp ResourceFileName beg RotisSansSerifStd
resmp ResourceFileName : have NO map record.
resmp ResourceFileName : retrieving %rom%Resource/CIDFont/RotisSansSerifStd
resmp ResourceFileName end
resmp ResourceStatus end
cidcm GetCIDSystemInfo end
resmp ResourceStatus end

据我所知,Ghostscript 应该可以使用 otf 字体,我想知道为什么当我添加到 Fontmap.GS 时会发现“没有地图记录”:

/RotisSansSerifStd          (C:\Windows\Fonts\RotisSansSerifStd-Regular.otf)    ;
/RotisSansSerifStd,Bold         (C:\Windows\Fonts\RotisSansSerifStd-Bold.otf)   ;
/RotisSansSerifStd-Regular      (C:\Windows\Fonts\RotisSansSerifStd-Regular.otf)    ;
/RotisSansSerifStd-Bold         (C:\Windows\Fonts\RotisSansSerifStd-Bold.otf)   ;

我做错了什么?

【问题讨论】:

【参考方案1】:

首先,您不能(目前)使用带有 CFF 轮廓的 OTF 字体来代替缺少的 CIDFont,您可以使用带有 TrueType 轮廓的 OTF 字体。我相信您可以使用带有 CFF 轮廓的 OTF 字体来代替缺少的字体。

您的 PDF 文件似乎缺少 CIDFont(这将有助于查看 GS 的所有输出但没有设置 RESMPDEBUG),您正在修改 fontmap.GS,它只定义了丢失字体的替代品,而不是 CIDFont。您需要修改 cidfmap 而不是 fontmap.GS 才能为缺少的 CIDFont 定义替代品。

据我所知,“没有地图记录”警告是完全正确的,在 cidfmap 中没有命名 CIDFont 的地图记录。

【讨论】:

以上是关于无法让 Ghostscript 使用 OpenType 字体的主要内容,如果未能解决你的问题,请参考以下文章

我可以让 GhostScript 使用超过 2 GB 的内存吗?

无法导入ghostscript

Ghostscript.NET 无法使用选定的打印机名称进行打印

无法在 macOS X 上安装 ghostscript

让 ghostscript 接收名称中带有空格的文件(例如“我的文档”中的某些内容)

无法使用 ImageMagick 和 GhostScript 将 PDF 转换为 JPG