我有一个 PDF(由 PowerPoint 生成),其中包含数学字符,使用默认 PDF 查看器或 Okular 查看时不会显示这些字符(希腊字母、平方根符号……全部显示为空白)。检查文档属性时会显示这些字体:
这一定与此有关,Symbol TrueType @ /usr/share/fonts/type1/gsfonts/s050000l.pfb
因为我有另一个 PDF,其中缺少这种字体,但所有数学符号都显示正确:
因此,Ubuntu 似乎认为它知道如何处理该字体,但它似乎没有选择正确的文件 (?)。我该如何解决这个问题?
ttf-mscorefonts-安装程序
$ ls /usr/share/fonts/truetype/msttcorefonts
Andale_Mono.ttf Georgia.ttf
andalemo.ttf georgiaz.ttf
arialbd.ttf impact.ttf
arialbi.ttf Impact.ttf
Arial_Black.ttf timesbd.ttf
Arial_Bold_Italic.ttf timesbi.ttf
Arial_Bold.ttf timesi.ttf
Arial_Italic.ttf Times_New_Roman_Bold_Italic.ttf
ariali.ttf Times_New_Roman_Bold.ttf
arial.ttf Times_New_Roman_Italic.ttf
Arial.ttf Times_New_Roman.ttf
ariblk.ttf times.ttf
comicbd.ttf trebucbd.ttf
Comic_Sans_MS_Bold.ttf trebucbi.ttf
Comic_Sans_MS.ttf Trebuchet_MS_Bold_Italic.ttf
comic.ttf Trebuchet_MS_Bold.ttf
courbd.ttf Trebuchet_MS_Italic.ttf
courbi.ttf Trebuchet_MS.ttf
Courier_New_Bold_Italic.ttf trebucit.ttf
Courier_New_Bold.ttf trebuc.ttf
Courier_New_Italic.ttf Verdana_Bold_Italic.ttf
Courier_New.ttf Verdana_Bold.ttf
couri.ttf verdanab.ttf
cour.ttf Verdana_Italic.ttf
Georgia_Bold_Italic.ttf verdanai.ttf
Georgia_Bold.ttf verdana.ttf
georgiab.ttf Verdana.ttf
Georgia_Italic.ttf verdanaz.ttf
georgiai.ttf webdings.ttf
georgia.ttf Webdings.ttf
pdf字体
$ pdffonts file.pdf
name type encoding emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
Arial,Bold TrueType WinAnsi no no no 11 0
Arial TrueType WinAnsi no no no 13 0
ABCDEE+Bookman Old Style,Bold TrueType WinAnsi yes yes no 22 0
Arial CID TrueType Identity-H yes no yes 24 0
ABCDEE+Gill Sans MT TrueType WinAnsi yes yes no 29 0
ABCDEE+Calibri TrueType WinAnsi yes yes no 31 0
ABCDEE+Cambria Math CID TrueType Identity-H yes yes yes 33 0
ABCDEE+Calibri,Bold TrueType WinAnsi yes yes no 38 0
ABCDEE+Gill Sans MT,BoldItalic TrueType WinAnsi yes yes no 40 0
ABCDEE+MS PGothic CID TrueType Identity-H yes yes yes 55 0
ABCDEE+Wingdings 3 CID TrueType Identity-H yes yes yes 67 0
Symbol TrueType WinAnsi no no no 61 0
Arial,Italic TrueType WinAnsi no no no 63 0
Times New Roman TrueType WinAnsi no no no 65 0
ABCDEE+Gill Sans MT CID TrueType Identity-H yes yes yes 80 0
ABCDEE+Gill Sans MT,Bold TrueType WinAnsi yes yes no 85 0
Arial TrueType WinAnsi no no no 104 0
Symbol TrueType WinAnsi no no no 124 0
Symbol CID TrueType Identity-H yes no yes 126 0
ABCDEE+Bookman Old Style TrueType WinAnsi yes yes no 181 0
ABCDEE+Gill Sans MT,Italic TrueType WinAnsi yes yes no 338 0
ABCEEE+Calibri CID TrueType Identity-H yes yes yes 353 0
ABCEEE+Calibri,Italic TrueType WinAnsi yes yes no 358 0
ABCEEE+Cambria Math TrueType WinAnsi yes yes no 366 0
使用gs
转换、嵌入字体
$ gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -dEmbedAllFonts=true -sOutputFile=output.pdf -f input.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 45.
Page 1
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.
Querying operating system for font files...
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.
Loading Arial-BoldMT font from /usr/share/fonts/truetype/msttcorefonts/arialbd.ttf... 5438668 3948958 8313792 3755578 4 done.
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 5438668 3951548 8868760 4454385 4 done.
Page 2
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 6453740 5062228 5195728 3745161 4 done.
Page 3
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 7020308 5614217 4598072 3190520 4 done.
Loading StandardSymbolsPS font from /usr/share/ghostscript/9.26/Resource/Font/StandardSymbolsPS... 7081292 5679471 4781816 3370698 4 done.
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/Arial-ItalicMT.
Can't find (or can't open) font file Arial-ItalicMT.
Loading Arial-ItalicMT font from /usr/share/fonts/truetype/msttcorefonts/ariali.ttf... 7098252 5691978 5314260 3859544 4 done.
Substituting font Times-Roman for Times New Roman.
Loading NimbusRoman-Regular font from /usr/share/ghostscript/9.26/Resource/Font/NimbusRoman-Regular... 7252796 5899262 5374860 3912605 4 done.
Page 4
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/Arial-ItalicMT.
Can't find (or can't open) font file Arial-ItalicMT.
Loading Arial-ItalicMT font from /usr/share/fonts/truetype/msttcorefonts/ariali.ttf... 6611260 4833245 3319604 1949433 4 done.
Substituting font Times-Roman for Times New Roman.
Page 5
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/Arial-ItalicMT.
Can't find (or can't open) font file Arial-ItalicMT.
Loading Arial-ItalicMT font from /usr/share/fonts/truetype/msttcorefonts/ariali.ttf... 6949372 5365174 3675396 2276187 4 done.
Substituting font Times-Roman for Times New Roman.
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 6949756 5398682 4641112 3174936 4 done.
Page 6
Page 7
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/Arial-ItalicMT.
Can't find (or can't open) font file Arial-ItalicMT.
Loading Arial-ItalicMT font from /usr/share/fonts/truetype/msttcorefonts/ariali.ttf... 7865308 6343710 4006404 2599211 4 done.
Substituting font Times-Roman for Times New Roman.
Page 8
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 8342900 6810545 4239736 2830396 4 done.
Substituting font Times-Roman for Times New Roman.
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/Arial-ItalicMT.
Can't find (or can't open) font file Arial-ItalicMT.
Loading Arial-ItalicMT font from /usr/share/fonts/truetype/msttcorefonts/ariali.ttf... 8410908 6871209 5009468 3534500 4 done.
Page 9
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 9031540 7489505 4504912 3077262 4 done.
Page 10
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/Arial-ItalicMT.
Can't find (or can't open) font file Arial-ItalicMT.
Loading Arial-ItalicMT font from /usr/share/fonts/truetype/msttcorefonts/ariali.ttf... 9530484 7987495 4548096 3120991 4 done.
Substituting font Times-Roman for Times New Roman.
Page 11
Page 12
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 10806660 9233027 4998584 3541002 4 done.
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/Arial-ItalicMT.
Can't find (or can't open) font file Arial-ItalicMT.
Loading Arial-ItalicMT font from /usr/share/fonts/truetype/msttcorefonts/ariali.ttf... 10854852 9294651 5714772 4207457 4 done.
Substituting font Times-Roman for Times New Roman.
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.
Loading Arial-BoldMT font from /usr/share/fonts/truetype/msttcorefonts/arialbd.ttf... 10874668 9301875 6778920 5207917 4 done.
Page 13
Substituting font Times-Roman for Times New Roman.
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/Arial-ItalicMT.
Can't find (or can't open) font file Arial-ItalicMT.
Loading Arial-ItalicMT font from /usr/share/fonts/truetype/msttcorefonts/ariali.ttf... 11393812 9807435 5199732 3724211 4 done.
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.
Loading Arial-BoldMT font from /usr/share/fonts/truetype/msttcorefonts/arialbd.ttf... 11414396 9836851 6076592 4544609 4 done.
Page 14
Substituting font Times-Roman for Times New Roman.
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/Arial-ItalicMT.
Can't find (or can't open) font file Arial-ItalicMT.
Loading Arial-ItalicMT font from /usr/share/fonts/truetype/msttcorefonts/ariali.ttf... 11892372 10304203 5312212 3838195 4 done.
Page 15
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 12949044 11347939 5199476 3735796 4 done.
Page 16
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 13733300 12123407 5243096 3784092 4 done.
Page 17
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 5948100 4103896 6659512 3938938 4 done.
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.
Loading Arial-BoldMT font from /usr/share/fonts/truetype/msttcorefonts/arialbd.ttf... 6952068 5218616 7605152 4812056 4 done.
Page 18
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/Arial-ItalicMT.
Can't find (or can't open) font file Arial-ItalicMT.
Loading Arial-ItalicMT font from /usr/share/fonts/truetype/msttcorefonts/ariali.ttf... 7336452 5714809 4622308 3089517 4 done.
Substituting font Times-Roman for Times New Roman.
Page 19
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/Arial-ItalicMT.
Can't find (or can't open) font file Arial-ItalicMT.
Loading Arial-ItalicMT font from /usr/share/fonts/truetype/msttcorefonts/ariali.ttf... 7672644 6161827 4672896 3190509 4 done.
Substituting font Times-Roman for Times New Roman.
Page 20
Substituting font Times-Roman for Times New Roman.
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/Arial-ItalicMT.
Can't find (or can't open) font file Arial-ItalicMT.
Loading Arial-ItalicMT font from /usr/share/fonts/truetype/msttcorefonts/ariali.ttf... 8211604 6693185 4734356 3268746 4 done.
Page 21
Page 22
Page 23
Page 24
Page 25
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/Arial-ItalicMT.
Can't find (or can't open) font file Arial-ItalicMT.
Loading Arial-ItalicMT font from /usr/share/fonts/truetype/msttcorefonts/ariali.ttf... 12232444 10680036 5259124 3793189 4 done.
Substituting font Times-Roman for Times New Roman.
Page 26
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/Arial-ItalicMT.
Can't find (or can't open) font file Arial-ItalicMT.
Loading Arial-ItalicMT font from /usr/share/fonts/truetype/msttcorefonts/ariali.ttf... 12709652 11139380 5035716 3580478 4 done.
Substituting font Times-Roman for Times New Roman.
Page 27
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 13357788 11769684 6405532 4914193 4 done.
Page 28
Page 29
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/Arial-ItalicMT.
Can't find (or can't open) font file Arial-ItalicMT.
Loading Arial-ItalicMT font from /usr/share/fonts/truetype/msttcorefonts/ariali.ttf... 6285828 4550537 4884908 3405562 4 done.
Substituting font Times-Roman for Times New Roman.
Page 30
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/Arial-ItalicMT.
Can't find (or can't open) font file Arial-ItalicMT.
Loading Arial-ItalicMT font from /usr/share/fonts/truetype/msttcorefonts/ariali.ttf... 6622020 5000459 4955696 3473463 4 done.
Substituting font Times-Roman for Times New Roman.
Page 31
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/Arial-ItalicMT.
Can't find (or can't open) font file Arial-ItalicMT.
Loading Arial-ItalicMT font from /usr/share/fonts/truetype/msttcorefonts/ariali.ttf... 7040164 5516803 5611720 4187589 4 done.
Substituting font Times-Roman for Times New Roman.
Page 32
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/Arial-ItalicMT.
Can't find (or can't open) font file Arial-ItalicMT.
Loading Arial-ItalicMT font from /usr/share/fonts/truetype/msttcorefonts/ariali.ttf... 7558540 6021845 5023300 3599125 4 done.
Substituting font Times-Roman for Times New Roman.
Page 33
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 8015164 6460885 5146956 3688352 4 done.
Page 34
Page 35
Page 36
Page 37
Page 38
Page 39
Page 40
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.
Loading Arial-BoldMT font from /usr/share/fonts/truetype/msttcorefonts/arialbd.ttf... 11547020 9925465 8016724 6474207 4 done.
Page 41
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 12720380 11089561 5897352 4412661 4 done.
Page 42
Page 43
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.
Loading Arial-BoldMT font from /usr/share/fonts/truetype/msttcorefonts/arialbd.ttf... 7216412 5360220 7719020 4704158 4 done.
Page 44
Can't find (or can't open) font file /usr/share/ghostscript/9.26/Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 7553372 5820641 6214884 4791301 4 done.
Page 45
$
$ pdffonts output.pdf
name type encoding emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
KZAQPI+Arial,Bold TrueType WinAnsi yes yes yes 16 0
QMEKPQ+Arial TrueType WinAnsi yes yes yes 18 0
ENEBGM+CambriaMath CID TrueType Identity-H yes yes yes 41 0
ATUGBJ+Arial CID TrueType Identity-H yes yes yes 33 0
MHWCPM+Calibri,Bold TrueType WinAnsi yes yes yes 44 0
SGLZZU+GillSansMT TrueType WinAnsi yes yes yes 36 0
EBSAOM+BookmanOldStyle,Bold TrueType WinAnsi yes yes yes 31 0
THBHHD+Calibri TrueType WinAnsi yes yes yes 38 0
GAXEYX+GillSansMT,BoldItalic TrueType WinAnsi yes yes yes 46 0
MCKUPH+Wingdings3 CID TrueType Identity-H yes yes yes 75 0
ZGYPCK+MSPGothic CID TrueType Identity-H yes yes yes 64 0
UOXGIT+Arial,Italic TrueType WinAnsi yes yes yes 67 0
TVYJGE+Times-Roman Type 1C WinAnsi yes yes no 69 0
MGUXLU+Symbol Type 1C Custom yes yes yes 71 0
IZAYRH+GillSansMT CID TrueType Identity-H yes yes yes 99 0
XGDJKG+GillSansMT,Bold TrueType WinAnsi yes yes yes 102 0
PSMPSV+Symbol CID TrueType Identity-H yes yes yes 156 0
DDKYDF+BookmanOldStyle TrueType WinAnsi yes yes yes 241 0
VKBFRW+GillSansMT,Italic TrueType WinAnsi yes yes yes 430 0
CQFOQR+Calibri CID TrueType Identity-H yes yes yes 461 0
UFTZDQ+Calibri,Italic TrueType WinAnsi yes yes yes 464 0
ZCJRTV+CambriaMath TrueType WinAnsi yes yes yes 475 0
Ubuntu 16.04 LTS
答案1
看起来有些字体没有嵌入到 PDF 文件中,但我们可以使用以下命令解决这个问题:
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -dEmbedAllFonts=true -sOutputFile=<my_file_embedded>.pdf -f <my_file>.pdf
这将获取您的输入“my_file.pdf”并通读它以查找字体,根据需要嵌入它们,然后将输出写入“my_file_embedded.pdf”