我已经阅读了大量关于从 PDF 转换(使用 ghostscript)到图像时字体问题的 stackoverflow 问题。
因为您没有嵌入字体,ghostscript 试图在您的系统中找到替代品并呈现更好的可能。
但我不明白为什么我的 MacOSX Preview 可以完美地呈现 PDF 而 ghostscript 不能。
gs -sFONTPATH=/Library/Fonts -sDEVICE=pngalpha -o file-%03d.png -r144 my.pdf
我什至告诉 gs 字体在哪里。
这是输出。
$ pdffonts cv18.pdf
Fontconfig warning: "/usr/local/etc/fonts/fonts.conf", line 86: unknown element "blank"
name type encoding emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
CenturyGothic,Bold TrueType WinAnsi no no no 13 0
CenturyGothic TrueType WinAnsi no no no 14 0
CourierNew TrueType WinAnsi no no no 15 0
Arial TrueType WinAnsi no no no 16 0
AYTOPC+Wingdings TrueType WinAnsi yes yes no 17 0
TimesNewRoman TrueType WinAnsi no no no 18 0
CenturyGothic,Italic TrueType WinAnsi no no no 24 0
$ gs -sDEVICE=pngalpha -o file-%03d.png -r300 cv18.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 2.
Page 1
Querying operating system for font files...
Substituting font NewCenturySchlbk-Bold for CenturyGothic,Bold.
Loading C059-Bold font from /usr/local/Cellar/ghostscript/9.26/share/ghostscript/9.26/Resource/Font/C059-Bold... 4357236 2918185 2219472 869812 4 done.
Substituting font NewCenturySchlbk-Roman for CenturyGothic.
Loading C059-Roman font from /usr/local/Cellar/ghostscript/9.26/share/ghostscript/9.26/Resource/Font/C059-Roman... 4504148 3145674 2313416 951449 4 done.
Substituting font Courier for CourierNew.
Loading NimbusMonoPS-Regular font from /usr/local/Cellar/ghostscript/9.26/share/ghostscript/9.26/Resource/Font/NimbusMonoPS-Regular... 4731860 3382093 2548760 1140366 4 done.
Can't find (or can't open) font file /usr/local/Cellar/ghostscript/9.26/share/ghostscript/9.26/Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Can't find (or can't open) font file /usr/local/Cellar/ghostscript/9.26/share/ghostscript/9.26/Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Didn't find this font on the system!
Substituting font Helvetica for ArialMT.
Loading NimbusSans-Regular font from /usr/local/Cellar/ghostscript/9.26/share/ghostscript/9.26/Resource/Font/NimbusSans-Regular... 4939372 3576328 2589160 1183936 4 done.
Can't find (or can't open) font file /usr/local/Cellar/ghostscript/9.26/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/local/Cellar/ghostscript/9.26/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/local/Cellar/ghostscript/9.26/share/ghostscript/9.26/Resource/Font/NimbusRoman-Regular... 5196116 3849418 3003064 1540393 4 done.
Page 2
Substituting font NewCenturySchlbk-Roman for CenturyGothic.
Substituting font NewCenturySchlbk-Bold for CenturyGothic,Bold.
Substituting font NewCenturySchlbk-Italic for CenturyGothic,Italic.
Loading C059-Italic font from /usr/local/Cellar/ghostscript/9.26/share/ghostscript/9.26/Resource/Font/C059-Italic... 5504628 4138508 2467960 1088660 4 done.
问题是:为什么 MacOSX Preview 没有这个问题?它从哪里获取字体,以完美呈现?