Revision: 5732
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5732&view=rev
Author:   mdboom
Date:     2008-07-10 08:45:15 -0700 (Thu, 10 Jul 2008)

Log Message:
-----------
Bugfix: crash displaying fontconfig pattern

Modified Paths:
--------------
    trunk/matplotlib/CHANGELOG
    trunk/matplotlib/lib/matplotlib/fontconfig_pattern.py

Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG  2008-07-10 14:13:07 UTC (rev 5731)
+++ trunk/matplotlib/CHANGELOG  2008-07-10 15:45:15 UTC (rev 5732)
@@ -1,3 +1,5 @@
+2008-07-10 Bugfix: crash displaying fontconfig pattern - MGD
+
 2008-07-10 Bugfix: [ 2013963 ] update_datalim_bounds in Axes not works - MGD
 
 2008-07-10 Bugfix: [ 2014183 ] multiple imshow() causes gray edges - MGD

Modified: trunk/matplotlib/lib/matplotlib/fontconfig_pattern.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/fontconfig_pattern.py       2008-07-10 
14:13:07 UTC (rev 5731)
+++ trunk/matplotlib/lib/matplotlib/fontconfig_pattern.py       2008-07-10 
15:45:15 UTC (rev 5732)
@@ -123,23 +123,23 @@
         return props
 
     def _family(self, s, loc, tokens):
-        return [family_unescape(r'\1', tokens[0])]
+        return [family_unescape(r'\1', str(tokens[0]))]
 
     def _size(self, s, loc, tokens):
         return [float(tokens[0])]
 
     def _name(self, s, loc, tokens):
-        return [tokens[0]]
+        return [str(tokens[0])]
 
     def _value(self, s, loc, tokens):
-        return [value_unescape(r'\1', tokens[0])]
+        return [value_unescape(r'\1', str(tokens[0]))]
 
     def _families(self, s, loc, tokens):
-        self._properties['family'] = tokens
+        self._properties['family'] = [str(x) for x in tokens]
         return []
 
     def _point_sizes(self, s, loc, tokens):
-        self._properties['size'] = tokens
+        self._properties['size'] = [str(x) for x in tokens]
         return []
 
     def _property(self, s, loc, tokens):
@@ -161,10 +161,13 @@
     props = []
     families = ''
     size = ''
-    for key, val in d.items():
+    for key in 'family style variant weight stretch file size'.split():
+        val = getattr(d, 'get_' + key)()
         if val is not None and val != []:
-            val = [value_escape(r'\\\1', str(x)) for x in val if x is not None]
-            if val != []:
-                val = ','.join(val)
-                props.append(":%s=%s" % (key, val))
+            if type(val) == list:
+                val = [value_escape(r'\\\1', str(x)) for x in val if x is not 
None]
+                if val != []:
+                    val = ','.join(val)
+            props.append(":%s=%s" % (key, val))
+    print parse_fontconfig_pattern(''.join(props))
     return ''.join(props)


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to