首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Ghostscript -找不到(或不能打开)字体文件

Ghostscript -找不到(或不能打开)字体文件
EN

Stack Overflow用户
提问于 2019-05-21 10:19:25
回答 1查看 4.2K关注 0票数 1

我试图从php (imagemagic)中的pdf中创建一个图像。在图像文本上丢失。

要调试此问题,我转到CLI并使用folowing命令:

gs -sDevice=png16m -sOutputFile="test.png" test.pdf

现在我明白了:

代码语言:javascript
运行
复制
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
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.
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.
Querying operating system for font files...
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... 4395876 2792289 6087360 4693359 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... 4395876 2792684 6897144 5444610 4 done.
Can't find CID font "Arial".
Attempting to substitute CID font /Adobe-Identity for /Arial, 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.
Can't find CMap Identity-UTF16-H building a CIDDecoding resource. 
Warning: falling back to Identity ordering
Loading a TT font from /usr/share/ghostscript/9.26/Resource/CIDFSubst/DroidSansFallback.ttf to emulate a CID font CIDFallBack ... Done.
Can't find CMap Identity-UTF16-H building a CIDDecoding resource. 
   **** Error: can't process embedded font stream,
        attempting to load the font using its name.
               Output may be incorrect.
Can't find CID font "Arial".
Attempting to substitute CID font /Adobe-Identity for /Arial, 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.
Can't find CMap Identity-UTF16-H building a CIDDecoding resource. 
Warning: falling back to Identity ordering
Loading a TT font from /usr/share/ghostscript/9.26/Resource/CIDFSubst/DroidSansFallback.ttf to emulate a CID font CIDFallBack ... Done.
Can't find CMap Identity-UTF16-H building a CIDDecoding resource. 
   **** Error reading a content stream. The page may be incomplete.
               Output may be incorrect.
   **** Error: File did not complete the page properly and may be damaged.
               Output may be incorrect.
%%BoundingBox: 85 470 562 757
%%HiResBoundingBox: 85.491068 470.681986 561.761983 756.827977

我发现了很多话题,也尝试了很多,但我解决不了这个问题。我认为问题在于CID字体,但我不确定。

有人能给我一些如何解决这个问题的建议吗?

服务器: Debian GNU/Linux 9(拉伸) Ghostscript: GPL Ghostscript 9.26 (2018-11-20)

EN

回答 1

Stack Overflow用户

发布于 2019-05-21 11:08:29

你似乎有几个问题。很难确定,因为您甚至没有提供PDF文件来检查。

首先,您的PDF文件似乎试图使用一个名为'Arial‘的CIDFont,它没有嵌入到PDF文件中。它也不包含正则字体ArialMT和ArialMT,但是您似乎可以从fontmap.GS或通过fontconfig (如果您的构建包含这些字体)获得susb妓女字体。

不嵌入字体是一种糟糕的做法,在PDF规范中,没有嵌入CIDFonts是被特别反对的。

Ghostscript尝试它的后备方法来定义一个替代CIDFont来代替缺少的Arial CIDFont。首先,它尝试备用字体Adobe(名称是从CIDSystemInfo派生的),但CIDFont也不可用。因此,它回到了下一次尝试,即使用DroidSansFallback。

但是,这失败了,因为为了产生令人满意的替代,Ghostscript需要一个CMap,以便构建一个CIDDecoding资源。您的安装似乎缺少相关的CMap。

看起来您的发行版已经打包了Ghostscript,这样它就不使用ROM文件系统了。相反,“看起来”所有文件都安装在/usr/share/ghostscript/9.26下面的磁盘上。

您应该查找/usr/share/ghostscript/9.26/Resource/CMap目录,并查看是否有一个名为Identity-UTF16-H的文件。

我猜没有,这将是由于您的包维护者所做的决定。我不知道为什么他们会选择不包含该文件,但是如果没有它(以及文件夹中的其他文件),CIDFont支持就会受到阻碍。

如果它不存在,我建议您使用Debian包维护器。由于Ghostscript是在AGPL下授权的,源代码(包括所有支持文件)当然可以从Ghostscript Git存储库和Ghostscript网站获得。你可以从那里找出丢失的文件。

请注意,当前版本为9.27,我建议进行升级。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56236126

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档