From 3ddd5ded64950d7746b55d22a3b9315e2045b68c Mon Sep 17 00:00:00 2001 From: Emanuele Plebani Date: Mon, 21 Sep 2015 09:40:39 +0200 Subject: [PATCH] fix fatal error with Ghostscript when saving pdfs on Linux --- external/other/savefig.m | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/external/other/savefig.m b/external/other/savefig.m index d559f67b..452d0ed4 100644 --- a/external/other/savefig.m +++ b/external/other/savefig.m @@ -203,10 +203,13 @@ function savefig(fname, varargin) % Generate the gs command. switch(computer) % Get gs command. - case {'MAC','MACI'}, gs= '/usr/local/bin/gs'; - case {'PCWIN'}, gs= 'gswin32c.exe'; - case {'PCWIN64'}, gs= 'gswin64c.exe'; - otherwise, gs= 'gs'; + case {'MAC','MACI'}, gs= '/usr/local/bin/gs'; + case {'PCWIN'}, gs= 'gswin32c.exe'; + case {'PCWIN64'}, gs= 'gswin64c.exe'; + case {'GLNXA64'}, + setenv('LD_LIBRARY_PATH','/usr/lib/x86_64-linux-gnu'); + gs= 'gs'; % avoid issues with GS < 9.16 on Linux + otherwise, gs= 'gs'; end gs= [gs ' -q -dNOPAUSE -dBATCH -dEPSCrop']; % Essential. gs= [gs ' -dPDFSETTINGS=/prepress -dEmbedAllFonts=' fonts]; % Must be first?