我目前正在使用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路径中。没有变化。Google i还发现了一些未定义的问题。似乎没有什么是相关的,或者建议的改变不适用或不起作用。我试着在另一个系统上重现这个问题,它可以工作。
我系统:Arch Linux 64-Bit with KDE (Kernel 3.13.6-1-ARCH)
Ghostscript 9.10
epstopdf 2.21
Matlab 2013a for Unix
有什么建议是什么原因造成的,我如何才能解决这个问题?
谢谢你的帮助!
//编辑:我上传了一个我正在使用的文件
///编辑:我试图改变GS_PATH从"/home/matze/。字体"to"/home/matze/。fonts:/usr/share/fonts/TTF:/usr/share/fonts/Type1:/usr/share/fonts"。但是如果我再次打印变量,它仍然是旧的内容。
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_LIB
, GS_LIB_DEFAULT
, GS_FONTPATH
和PATH
(参见如何使用Ghostscript的第8.10节字体查找)是否与字体相关。然后用setenv
更新MATLAB生成的进程所使用的路径。例如,
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');