Hi,

I have an interesting problem using fonts in matplotlib on OS X 10.4.  
When I use a font other than the Bitstream Vera provided with MPL  
0.90.0, I cannot create readable eps files. More specifically, if I  
use a font from the OS X system choices, MPL happily creates an eps  
file, but it causes errors in preview, imagemagick, and ps2pdf. This  
occurs if I use either the PS or the TkAgg backend to create the eps  
file:

[EMAIL PROTECTED] test]$ ps2pdf test.eps
Error: /invalidfont in -dict-
Operand stack:
    Futura-Medium   --dict:11/14(L)--   Font   Futura-Medium   --dict: 
11/14(L)--   Futura-Medium
Execution stack:
    %interp_exit   .runexec2   --nostringval--   --nostringval--   -- 
nostringval--   2   %stopped_push   --nostringval--   -- 
nostringval--   --nostringval--   false   1   %stopped_push   1   3    
%oparray_pop   1   3   %oparray_pop   --nostringval--   1   3   % 
oparray_pop   1   3   %oparray_pop   .runexec2   --nostringval--   -- 
nostringval--   --nostringval--   2   %stopped_push   -- 
nostringval--   2   4   %oparray_pop   3   4   %oparray_pop   -- 
nostringval--   --nostringval--   --nostringval--   7   5   % 
oparray_pop   --nostringval--   7   5   %oparray_pop
Dictionary stack:
    --dict:1120/1686(ro)(G)--   --dict:0/20(G)--   --dict:75/200 
(L)--   --dict:6/7(L)--   --dict:17/17(ro)(G)--
Current allocation mode is local
Last OS error: 2
Current file position is 618791
AFPL Ghostscript 8.51: Unrecoverable error, exit code 1

However, if the output is NOT eps, I can create and view pdf, png,  
and TkAgg plots with whatever font I choose. A code sample that  
produces the above error on eps output is below.

I hope someone might be able to shed some light on my problem. I have  
not been able to test the eps file on another platform; the bug may  
well rest on OS X outside of MPL. Unfortunately, I need eps files for  
a journal, and I would like to use a font other than Vera.

thanks,

jeff oishi

#!/usr/bin/env python

from matplotlib import rcParams
import pylab as P
import numpy as N

#this makes no difference
#rcParams['backend'] = 'PS'
rcParams['backend'] = 'TkAgg'

# this fails
rcParams['font.family'] = 'sans-serif'
rcParams['font.sans-serif'] = 'Futura'

# this succeeds
#rcParams['font.family'] = 'serif'
#rcParams['font.serif'] = 'Bitstream Vera Serif'

if __name__ == "__main__":
   x = N.linspace(0,2*N.pi,1000)
   y = N.sin(x)
   P.plot(x,y)
   P.xlabel('test')
   P.ylabel('another test')

   P.savefig('test.eps')

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to