【问题标题】:eps2eps, epstopdf, ghostscript Error: /undefined in --definefont-- (Usage from Matlab)eps2eps、epstopdf、ghostscript 错误:/undefined in --definefont--(来自 Matlab 的用法)
【发布时间】:2014-03-19 19:43:37
【问题描述】:

我目前正在使用 eps2eps 和 epstopdf 在 Matlab 中编写脚本。当我使用 Matlab 中的 eps2eps 或 epstopdf 时,会发生以下情况:

>> system('eps2eps TEMP97062.ps TEMP97062.eps');
Error: /undefined in --definefont--
Operand stack:
   false   CMR10   --dict:12/21(L)--   Font   definefont   --dict:30/32(L)--   unknownerror
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1    %stopped_push   1900   1   3   %oparray_pop   1899   1   3   %oparray_pop   1883   1   3   %oparray_pop   1771   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   1762   3   3   %oparray_pop   --nostringval--   --nostringval--   1850   3   4   %oparray_pop   --nostringval--
Dictionary stack:
   --dict:1171/1684(ro)(G)--   --dict:0/20(G)--   --dict:81/200(L)--   --dict:1171/1684(ro)(G)--
Current allocation mode is local
Last OS error: No such file or directory
GPL Ghostscript 9.10: Unrecoverable error, exit code 1

但是: 如果我使用 bash 中的 eps2eps,一切都会完美无缺。

这可能是找不到字体的问题吗?

到目前为止我做了什么: 我检查了bash和matlab的环境值,指向字体的都是一样的。 我将 /usr/share/fonts/Type1/ 目录添加到 matlab 路径中。没有变化。 谷歌我发现了一些其他未定义的问题。似乎没有任何关系,或者建议的更改不适用或不起作用。 我试图用另一个系统重现这个问题,它可以工作。

我的系统:

Arch Linux 64-Bit with KDE (Kernel 3.13.6-1-ARCH)
Ghostscript 9.10
epstopdf 2.21
Matlab 2013a for Unix

任何建议是什么导致了这个问题以及我如何解决这个问题?

感谢您的帮助!

//编辑:I uploaded one of the files i'm using

///编辑:我试图将 GS_PATH 从“/home/matze/.fonts”更改为“/home/matze/.fonts:/usr/share/fonts/TTF:/usr/share/fonts/Type1 :/usr/share/fonts" 来自 Matlab。但是如果我再次打印变量,它仍然有旧的内容。

【问题讨论】:

  • 错误很明显:找不到字体“CMR10”。您设置了路径,但您是否将字体添加到 GS? “要添加自己的字体,您必须编辑 Fontmap 以在末尾包含新字体的条目”,首先点击“ghostscript 添加字体”。
  • 谢谢,睡觉后试试。但是如果字体没有正确安装,为什么 eps2eps 直接从 shell 工作?

标签: bash matlab pdf ghostscript postscript


【解决方案1】:

MATLAB system 命令设置环境变量的方式与您从登录 shell 或使用 xterm 等打开的常规 shell 不同。尝试明确指定字体的路径:

system('eps2eps -I/usr/share/fonts/Type1/ TEMP97062.ps TEMP97062.eps');

system('eps2eps -sFONTPATH=/usr/share/fonts/Type1/ TEMP97062.ps TEMP97062.eps');

尝试任何其他可能包含 CMR10 的文件夹,用: 分隔多个路径。


另一种可能的解决方案是修复损坏的环境变量。在 bash 中,检查环境变量 GS_LIBGS_LIB_DEFAULTGS_FONTPATHPATH(参见如何使用 Ghostscript 的 Section 8.10 Font Look Up)以了解与字体相关的任何内容。然后update the path used by processes spawned by MATLAB with setenv。例如,

setenv('GS_LIB', [getenv('GS_LIB') ':/usr/share/fonts/Type1/']);
setenv('PATH', [getenv('PATH') ':/usr/share/fonts/Type1/']);
% ... any other relevant variables
system('eps2eps TEMP97062.ps TEMP97062.eps');

【讨论】:

  • 我尝试将所有包含字体的文件夹添加到 PATH、GS_LIB 和 sFONTPATH。还是一样的错误。
  • 查看我的第二次编辑,添加到 GS_LIB 并不太奏效。
  • @Martze 如果您在setenv(...,[getenv(...) ':/new']) 之后执行getenv,那么您尝试添加的内容不在该变量中?听起来setenv 有问题。
猜你喜欢
  • 1970-01-01
  • 2017-03-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-02-06
  • 2016-10-29
相关资源
最近更新 更多