Revision: 3964 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3964&view=rev Author: mdboom Date: 2007-10-18 11:07:06 -0700 (Thu, 18 Oct 2007)
Log Message: ----------- Faster version of fill() for PDF writing Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2007-10-18 17:40:30 UTC (rev 3963) +++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2007-10-18 18:07:06 UTC (rev 3964) @@ -90,15 +90,19 @@ """Make one string from sequence of strings, with whitespace in between. The whitespace is chosen to form lines of at most linelen characters, if possible.""" - - s, strings = [strings[0]], strings[1:] - while strings: - if len(s[-1]) + len(strings[0]) < linelen: - s[-1] += ' ' + strings[0] + currpos = 0 + lasti = 0 + result = [] + for i, s in enumerate(strings): + length = len(s) + if currpos + length < linelen: + currpos += length + 1 else: - s.append(strings[0]) - strings = strings[1:] - return '\n'.join(s) + result.append(' '.join(strings[lasti:i])) + lasti = i + currpos = length + result.append(' '.join(strings[lasti:])) + return '\n'.join(result) def pdfRepr(obj): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins