Lionel Roubeyrie <[EMAIL PROTECTED]>
writes:

> I've got a problem with saving plots in pdf format like you can see in the 
> following output. It seems encodings.cp1252 doesn't have a decoding_map 
> method (but a decoding_table one).
> Is it a bug or a problem in my encodings file?

It's a bug, fixed in svn some time ago. Here's the patch if you want to
fix it in your version:

Index: backend_pdf.py
===================================================================
--- backend_pdf.py      (revision 3449)
+++ backend_pdf.py      (revision 3476)
@@ -500,11 +500,20 @@
         # composite font, based on multi-byte characters.
 
         from encodings import cp1252
-        firstchar, lastchar = 0, 255
+        # The "decoding_map" was changed to a "decoding_table" as of Python 2.5.
+        if hasattr(cp1252, 'decoding_map'):
+            def decode_char(charcode):
+                return cp1252.decoding_map[charcode] or 0
+        else:
+            def decode_char(charcode):
+                return ord(cp1252.decoding_table[charcode])
+
         def get_char_width(charcode):
-            unicode = cp1252.decoding_map[charcode] or 0
+            unicode = decode_char(charcode)
             width = font.load_char(unicode, flags=LOAD_NO_SCALE).horiAdvance
             return cvt(width)
+
+        firstchar, lastchar = 0, 255
         widths = [ get_char_width(charcode) for charcode in range(firstchar, lastchar+1) ]
 
         widthsObject = self.reserveObject('font widths')
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
-------------------------------------------------------------------------
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