Skip to content

Commit 0a5f908

Browse files
committed
Change character ids so they are a hash on the path data itself. (To
fix Kaushik Ghose's copy-and-paste in Inkscape bug). svn path=/branches/v0_91_maint/; revision=5021
1 parent c6d43f0 commit 0a5f908

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/matplotlib/backends/backend_svg.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import division
22

3-
import os, codecs, base64, tempfile, urllib, gzip
3+
import os, codecs, base64, tempfile, urllib, gzip, md5
44

55
from matplotlib import agg
66
from matplotlib import verbose, __version__, rcParams
@@ -388,8 +388,9 @@ def _add_char_def(self, prop, char):
388388

389389
if step[0] != 4:
390390
currx, curry = step[-2], -step[-1]
391-
char_num = 'c_%x' % len(self._char_defs)
392-
path_element = '<path id="%s" d="%s"/>\n' % (char_num, ''.join(path_data))
391+
path_data = ''.join(path_data)
392+
char_num = 'c_%x' % len(self._char_defs) # md5.new(path_data).hexdigest()
393+
path_element = '<symbol id="%s"><path d="%s"/></symbol>\n' % (char_num, ''.join(path_data))
393394
self._char_defs[char_id] = char_num
394395
return path_element
395396

0 commit comments

Comments
 (0)