使用 Ghostscript 进行 PDF 转换会破坏字体

问题描述 投票:0回答:1

我正在尝试使用 Ghostscript 将 pdf 合并在一起,但遇到字体问题。下面的屏幕截图 - 左边是输入,右边是输出。 “标准”拉丁部分是正确的,非标准错误(CID?),尽管它们使用相同的字体。

这是脚本输出(为了清楚起见,我添加了额外的换行符和数字):

$ gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=out.pdf in.pdf
GPL Ghostscript 9.26 (2018-11-20)
Copyright (C) 2018 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
-- 1
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/TimesNewRomanPSMT.
Can't find (or can't open) font file TimesNewRomanPSMT.
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/TimesNewRomanPSMT.
Can't find (or can't open) font file TimesNewRomanPSMT.
Querying operating system for font files...
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/TimesNewRomanPSMT.
Can't find (or can't open) font file TimesNewRomanPSMT.
Didn't find this font on the system!
Substituting font Times-Roman for TimesNewRomanPSMT.
Loading NimbusRoman-Regular font from /usr/share/ghostscript/9.26/Resource/Font/NimbusRoman-Regular... 5046332 3572454 3115872 1726420 4 done.

-- 2
Can't find CID font "TimesNewRoman".
Attempting to substitute CID font /Adobe-Identity for /TimesNewRoman, see doc/Use.htm#CIDFontSubstitution.
The substitute CID font "Adobe-Identity" is not provided either. attempting to use fallback CIDFont.See doc/Use.htm#CIDFontSubstitution.
Loading a TT font from /usr/share/ghostscript/9.26/Resource/CIDFSubst/DroidSansFallback.ttf to emulate a CID font Adobe-Identity ... Done.

-- 3
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/TimesNewRomanPS-ItalicMT.
Can't find (or can't open) font file TimesNewRomanPS-ItalicMT.
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/TimesNewRomanPS-ItalicMT.
Can't find (or can't open) font file TimesNewRomanPS-ItalicMT.
Didn't find this font on the system!
Substituting font Times-Italic for TimesNewRomanPS-ItalicMT.
Loading NimbusRoman-Italic font from /usr/share/ghostscript/9.26/Resource/Font/NimbusRoman-Italic... 9238300 7844767 3270416 1870892 4 done.

-- 4
Can't find CID font "TimesNewRoman".
Attempting to substitute CID font /Adobe-Identity for /TimesNewRoman, see doc/Use.htm#CIDFontSubstitution.
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/TimesNewRomanPS-BoldMT.
Can't find (or can't open) font file TimesNewRomanPS-BoldMT.
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/TimesNewRomanPS-BoldMT.
Can't find (or can't open) font file TimesNewRomanPS-BoldMT.
Didn't find this font on the system!
Substituting font Times-Bold for TimesNewRomanPS-BoldMT.
Loading NimbusRoman-Bold font from /usr/share/ghostscript/9.26/Resource/Font/NimbusRoman-Bold... 9486596 8090953 3465360 2062449 4 done.

-- 5
Can't find CID font "TimesNewRoman".
Attempting to substitute CID font /Adobe-Identity for /TimesNewRoman, see doc/Use.htm#CIDFontSubstitution.
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/Arial-BoldMT.
Can't find (or can't open) font file Arial-BoldMT.
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/Arial-BoldMT.
Can't find (or can't open) font file Arial-BoldMT.
Didn't find this font on the system!
Substituting font Helvetica-Bold for Arial-BoldMT.
Loading NimbusSans-Bold font from /usr/share/ghostscript/9.26/Resource/Font/NimbusSans-Bold... 9735428 8335065 3720904 2297241 4 done.

-- 6
Can't find CID font "Arial".
Attempting to substitute CID font /Adobe-Identity for /Arial, see doc/Use.htm#CIDFontSubstitution.
Can't find CID font "Arial".
Attempting to substitute CID font /Adobe-Identity for /Arial, see doc/Use.htm#CIDFontSubstitution.

有点难以理解 GS 想要告诉我的内容。 CID字体到底是什么?更重要的是,我该如何解决这个问题?另一种选择 - 如何使用 GS 将嵌入字体从原始 pdf 复制到新 PDF?

pdf fonts ghostscript
1个回答
0
投票
  1. 已安装
    ttf-mscorefonts-installer
    ,清除缓存中的字体缓存(不知道是否需要)
apt-get install ttf-mscorefonts-installer
fc-cache -f -v

1.1)安装字体的位置在我的情况下

/usr/share/fonts/truetype/msttcorefonts

  1. 将 CID 字体添加到 TTF 映射到
    cidfmap
    ,就我而言,在文件夹
    /var/lib/ghostscript/fonts/
    :
/TimesNewRoman << /FileType /TrueType /Path (/usr/share/fonts/truetype/msttcorefonts/times.ttf) /SubfontID 0 /CSI [(Identity) 0] >> ;
/TimesNewRoman,Bold << /FileType /TrueType /Path (/usr/share/fonts/truetype/msttcorefonts/timesbd.ttf) /SubfontID 0 /CSI [(Identity) 0] >> ;
/TimesNewRoman,Italic << /FileType /TrueType /Path (/usr/share/fonts/truetype/msttcorefonts/timesi.ttf) /SubfontID 0 /CSI [(Identity) 0] >> ;
/TimesNewRoman,Bold,Italic << /FileType /TrueType /Path (/usr/share/fonts/truetype/msttcorefonts/timesbi.ttf) /SubfontID 0 /CSI [(Identity) 0] >> ;
/Arial << /FileType /TrueType /Path (/usr/share/fonts/truetype/msttcorefonts/arial.ttf) /SubfontID 0 /CSI [(Identity) 0] >> ;
/Arial,Bold << /FileType /TrueType /Path (/usr/share/fonts/truetype/msttcorefonts/arialbd.ttf) /SubfontID 0 /CSI [(Identity) 0] >> ;
/Arial,Italic << /FileType /TrueType /Path (/usr/share/fonts/truetype/msttcorefonts/ariali.ttf) /SubfontID 0 /CSI [(Identity) 0] >> ;
/Arial,Bold,Italic << /FileType /TrueType /Path (/usr/share/fonts/truetype/msttcorefonts/arialbi.ttf) /SubfontID 0 /CSI [(Identity) 0] >> ;

注意不确定粗体+斜体(“/Arial,粗体,斜体”)的名称是否正确,也许有人可以确认这一点。

© www.soinside.com 2019 - 2024. All rights reserved.