SF.net SVN: matplotlib:[6862] trunk/matplotlib
Revision: 6862
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6862&view=rev
Author: jouni
Date: 2009-02-02 08:29:18 + (Mon, 02 Feb 2009)
Log Message:
---
Avoid malloc errors in ttconv for fonts that don't have e.g. PostName
as entry (1,0,0,6) in the name table (a version of Tahoma triggered this)
Modified Paths:
--
trunk/matplotlib/CHANGELOG
trunk/matplotlib/ttconv/pprdrv_tt.cpp
Modified: trunk/matplotlib/CHANGELOG
===
--- trunk/matplotlib/CHANGELOG 2009-01-30 16:31:47 UTC (rev 6861)
+++ trunk/matplotlib/CHANGELOG 2009-02-02 08:29:18 UTC (rev 6862)
@@ -1,3 +1,6 @@
+2009-02-02 Avoid malloc errors in ttconv for fonts that don't have
+ e.g. PostName (a version of Tahoma triggered this) - JKS
+
2009-01-30 Remove support for pyExcelerator in exceltools -- use xlwt
instead - JDH
Modified: trunk/matplotlib/ttconv/pprdrv_tt.cpp
===
--- trunk/matplotlib/ttconv/pprdrv_tt.cpp 2009-01-30 16:31:47 UTC (rev
6861)
+++ trunk/matplotlib/ttconv/pprdrv_tt.cpp 2009-02-02 08:29:18 UTC (rev
6862)
@@ -178,10 +178,18 @@
table_ptr = NULL;
-/* Set default values to avoid future references to */
-/* undefined pointers. */
-font->PostName = font->FullName =
- font->FamilyName = font->Version = font->Style = (char*)"unknown";
+/* Set default values to avoid future references to undefined
+ * pointers. Allocate each of PostName, FullName, FamilyName,
+ * Version, and Style separately so they can be freed safely. */
+for (char **ptr = &(font->PostName); ptr != NULL; ) {
+ *ptr = (char*) calloc(sizeof(char), strlen("unknown")+1);
+ strcpy(*ptr, "unknown");
+ if (ptr == &(font->PostName)) ptr = &(font->FullName);
+ else if (ptr == &(font->FullName)) ptr = &(font->FamilyName);
+ else if (ptr == &(font->FamilyName)) ptr = &(font->Version);
+ else if (ptr == &(font->Version)) ptr = &(font->Style);
+ else ptr = NULL;
+}
font->Copyright = font->Trademark = (char*)NULL;
table_ptr = GetTable(font, "name");/* pointer to table */
@@ -222,6 +230,7 @@
/* Font Family name */
if( platform == 1 && nameid == 1 )
{
+ free(font->FamilyName);
font->FamilyName = (char*)calloc(sizeof(char),length+1);
strncpy(font->FamilyName,(const char*)strings+offset,length);
font->FamilyName[length]=(char)NULL;
@@ -237,6 +246,7 @@
/* Font Family name */
if( platform == 1 && nameid == 2 )
{
+ free(font->Style);
font->Style = (char*)calloc(sizeof(char),length+1);
strncpy(font->Style,(const char*)strings+offset,length);
font->Style[length]=(char)NULL;
@@ -252,6 +262,7 @@
/* Full Font name */
if( platform == 1 && nameid == 4 )
{
+ free(font->FullName);
font->FullName = (char*)calloc(sizeof(char),length+1);
strncpy(font->FullName,(const char*)strings+offset,length);
font->FullName[length]=(char)NULL;
@@ -267,6 +278,7 @@
/* Version string */
if( platform == 1 && nameid == 5 )
{
+ free(font->Version);
font->Version = (char*)calloc(sizeof(char),length+1);
strncpy(font->Version,(const char*)strings+offset,length);
font->Version[length]=(char)NULL;
@@ -282,6 +294,7 @@
/* PostScript name */
if( platform == 1 && nameid == 6 )
{
+ free(font->PostName);
font->PostName = (char*)calloc(sizeof(char),length+1);
strncpy(font->PostName,(const char*)strings+offset,length);
font->PostName[length]=(char)NULL;
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:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib:[6864] trunk/matplotlib/lib/matplotlib/lines.py
Revision: 6864
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6864&view=rev
Author: mdboom
Date: 2009-02-02 16:19:33 + (Mon, 02 Feb 2009)
Log Message:
---
Fix bug in markevery where markers were being recursively removed.
Modified Paths:
--
trunk/matplotlib/lib/matplotlib/lines.py
Modified: trunk/matplotlib/lib/matplotlib/lines.py
===
--- trunk/matplotlib/lib/matplotlib/lines.py2009-02-02 12:42:08 UTC (rev
6863)
+++ trunk/matplotlib/lib/matplotlib/lines.py2009-02-02 16:19:33 UTC (rev
6864)
@@ -509,12 +509,16 @@
else:
startind, stride = 0, markevery
if tpath.codes is not None:
-tpath.codes = tpath.codes[startind::stride]
-tpath.vertices = tpath.vertices[startind::stride]
+codes = tpath.codes[startind::stride]
+else:
+codes = None
+vertices = tpath.vertices[startind::stride]
+subsampled = Path(vertices, codes)
+else:
+subsampled = tpath
-
markerFunc = getattr(self, funcname)
-markerFunc(renderer, gc, tpath, affine.frozen())
+markerFunc(renderer, gc, subsampled, affine.frozen())
renderer.close_group('line2d')
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:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib:[6866] trunk/matplotlib/lib/matplotlib/lines.py
Revision: 6866 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6866&view=rev Author: mdboom Date: 2009-02-02 17:12:27 + (Mon, 02 Feb 2009) Log Message: --- Fix markevery -- the tuple form was not working (if it ever was). Modified Paths: -- trunk/matplotlib/lib/matplotlib/lines.py Modified: trunk/matplotlib/lib/matplotlib/lines.py === --- trunk/matplotlib/lib/matplotlib/lines.py2009-02-02 16:29:37 UTC (rev 6865) +++ trunk/matplotlib/lib/matplotlib/lines.py2009-02-02 17:12:27 UTC (rev 6866) @@ -508,12 +508,12 @@ startind, stride = markevery else: startind, stride = 0, markevery -if tpath.codes is not None: -codes = tpath.codes[startind::stride] -else: -codes = None -vertices = tpath.vertices[startind::stride] -subsampled = Path(vertices, codes) +if tpath.codes is not None: +codes = tpath.codes[startind::stride] +else: +codes = None +vertices = tpath.vertices[startind::stride] +subsampled = Path(vertices, codes) else: subsampled = tpath 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: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib:[6868] trunk/matplotlib
Revision: 6868
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6868&view=rev
Author: jouni
Date: 2009-02-02 19:35:43 + (Mon, 02 Feb 2009)
Log Message:
---
Reduce number of marker objects in pdf output
Modified Paths:
--
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
Modified: trunk/matplotlib/CHANGELOG
===
--- trunk/matplotlib/CHANGELOG 2009-02-02 17:58:48 UTC (rev 6867)
+++ trunk/matplotlib/CHANGELOG 2009-02-02 19:35:43 UTC (rev 6868)
@@ -1,3 +1,5 @@
+2009-02-02 Reduce number of marker XObjects in pdf output - JKS
+
2009-02-02 Change default resolution on polar plot to 1 - MGD
2009-02-02 Avoid malloc errors in ttconv for fonts that don't have
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2009-02-02
17:58:48 UTC (rev 6867)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2009-02-02
19:35:43 UTC (rev 6868)
@@ -1109,26 +1109,28 @@
def markerObject(self, path, trans, fillp, lw):
"""Return name of a marker XObject representing the given path."""
-key = (path, trans, fillp is not None, lw)
+pathops = self.pathOperations(path, trans)
+key = (tuple(pathops), bool(fillp))
result = self.markers.get(key)
if result is None:
name = Name('M%d' % len(self.markers))
ob = self.reserveObject('marker %d' % len(self.markers))
-self.markers[key] = (name, ob, path, trans, fillp, lw)
+bbox = path.get_extents(trans)
+self.markers[key] = [name, ob, bbox, lw]
else:
+if result[-1] < lw:
+result[-1] = lw
name = result[0]
return name
def writeMarkers(self):
-for tup in self.markers.values():
-name, object, path, trans, fillp, lw = tup
-bbox = path.get_extents(trans)
+for (pathops, fillp),(name, ob, bbox, lw) in self.markers.iteritems():
bbox = bbox.padded(lw * 0.5)
self.beginStream(
-object.id, None,
+ob.id, None,
{'Type': Name('XObject'), 'Subtype': Name('Form'),
'BBox': list(bbox.extents) })
-self.writePath(path, trans)
+self.output(*pathops)
if fillp:
self.output(Op.fill_stroke)
else:
@@ -1280,10 +1282,17 @@
def draw_path(self, gc, path, transform, rgbFace=None):
self.check_gc(gc, rgbFace)
-stream = self.file.writePath(path, transform, rgbFace is None)
+self.file.writePath(path, transform, rgbFace is None)
self.file.output(self.gc.paint())
def draw_markers(self, gc, marker_path, marker_trans, path, trans,
rgbFace=None):
+# For simple paths or small numbers of markers, don't bother
+# making an XObject
+if len(path) * len(marker_path) <= 10:
+RendererBase.draw_markers(self, gc, marker_path, marker_trans,
+ path, trans, rgbFace)
+return
+
self.check_gc(gc, rgbFace)
fillp = rgbFace is not None
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:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib:[6867] trunk/matplotlib
Revision: 6867 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6867&view=rev Author: mdboom Date: 2009-02-02 17:58:48 + (Mon, 02 Feb 2009) Log Message: --- Make resolution of 1 be the default on a polar plot. Modified Paths: -- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/projections/polar.py Modified: trunk/matplotlib/CHANGELOG === --- trunk/matplotlib/CHANGELOG 2009-02-02 17:12:27 UTC (rev 6866) +++ trunk/matplotlib/CHANGELOG 2009-02-02 17:58:48 UTC (rev 6867) @@ -1,3 +1,5 @@ +2009-02-02 Change default resolution on polar plot to 1 - MGD + 2009-02-02 Avoid malloc errors in ttconv for fonts that don't have e.g. PostName (a version of Tahoma triggered this) - JKS Modified: trunk/matplotlib/lib/matplotlib/projections/polar.py === --- trunk/matplotlib/lib/matplotlib/projections/polar.py2009-02-02 17:12:27 UTC (rev 6866) +++ trunk/matplotlib/lib/matplotlib/projections/polar.py2009-02-02 17:58:48 UTC (rev 6867) @@ -177,7 +177,7 @@ return 0, vmax -RESOLUTION = 75 +RESOLUTION = 1 def __init__(self, *args, **kwargs): """ 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: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib:[6865] trunk/matplotlib
Revision: 6865
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6865&view=rev
Author: mdboom
Date: 2009-02-02 16:29:37 + (Mon, 02 Feb 2009)
Log Message:
---
Create path_cleanup code for use by the Mac OS-X backend. Refactor C++ code to
follow Numpy's guidelines for linking multiple C files into a single extension.
Remove dependency of Agg backend on _image.cpp and _ft2font.cpp (simplifies
linking problems and reduces generated code size).
Modified Paths:
--
trunk/matplotlib/lib/matplotlib/delaunay/VoronoiDiagramGenerator.cpp
trunk/matplotlib/setupext.py
trunk/matplotlib/src/_backend_agg.cpp
trunk/matplotlib/src/_backend_gdk.c
trunk/matplotlib/src/_gtkagg.cpp
trunk/matplotlib/src/_image.cpp
trunk/matplotlib/src/_image.h
trunk/matplotlib/src/_path.cpp
trunk/matplotlib/src/agg_py_path_iterator.h
trunk/matplotlib/src/agg_py_transforms.h
trunk/matplotlib/src/ft2font.cpp
trunk/matplotlib/src/numerix.h
trunk/matplotlib/src/path_converters.h
Added Paths:
---
trunk/matplotlib/src/agg_py_transforms.cpp
trunk/matplotlib/src/path_cleanup.cpp
trunk/matplotlib/src/path_cleanup.h
Modified: trunk/matplotlib/lib/matplotlib/delaunay/VoronoiDiagramGenerator.cpp
===
--- trunk/matplotlib/lib/matplotlib/delaunay/VoronoiDiagramGenerator.cpp
2009-02-02 16:19:33 UTC (rev 6864)
+++ trunk/matplotlib/lib/matplotlib/delaunay/VoronoiDiagramGenerator.cpp
2009-02-02 16:29:37 UTC (rev 6865)
@@ -12,9 +12,9 @@
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*/
-/*
- * This code was originally written by Stephan Fortune in C code. Shane
O'Sullivan,
- * have since modified it, encapsulating it in a C++ class and, fixing memory
leaks and
+/*
+ * This code was originally written by Stephan Fortune in C code. Shane
O'Sullivan,
+ * have since modified it, encapsulating it in a C++ class and, fixing memory
leaks and
* adding accessors to the Voronoi Edges.
* Permission to use, copy, modify, and distribute this software for any
* purpose without fee is hereby granted, provided that this entire notice
@@ -26,13 +26,17 @@
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*/
-
+
/*
* Subsequently, Robert Kern modified it to yield Python objects.
* Copyright 2005 Robert Kern
* See LICENSE.txt in the scipy source directory.
*/
+#include
+#define NO_IMPORT_ARRAY
+#include "numpy/arrayobject.h"
+
#include "VoronoiDiagramGenerator.h"
VoronoiDiagramGenerator::VoronoiDiagramGenerator()
@@ -74,9 +78,9 @@
nsites=numPoints;
plot = 0;
-triangulate = 0;
+triangulate = 0;
debug = 1;
-sorted = 0;
+sorted = 0;
freeinit(&sfl, sizeof (Site));
sites = (struct Site *) myalloc(nsites*sizeof( *sites));
@@ -108,9 +112,9 @@
//printf("\n%f %f\n",xValues[i],yValues[i]);
}
-
+
qsort(sites, nsites, sizeof (*sites), scomp);
-
+
siteidx = 0;
geominit();
double temp = 0;
@@ -130,9 +134,9 @@
borderMinY = minY;
borderMaxX = maxX;
borderMaxY = maxY;
-
-siteidx = 0;
+siteidx = 0;
+
voronoi(triangulate);
return true;
@@ -187,25 +191,25 @@
struct Halfedge * VoronoiDiagramGenerator::ELgethash(int b)
{
struct Halfedge *he;
-
-if(b<0 || b>=ELhashsize)
+
+if(b<0 || b>=ELhashsize)
return((struct Halfedge *) NULL);
-he = ELhash[b];
-if (he == (struct Halfedge *) NULL || he->ELedge != (struct Edge *)
DELETED )
+he = ELhash[b];
+if (he == (struct Halfedge *) NULL || he->ELedge != (struct Edge *)
DELETED )
return (he);
-
+
/* Hash table points to deleted half edge. Patch as necessary. */
ELhash[b] = (struct Halfedge *) NULL;
-if ((he -> ELrefcnt -= 1) == 0)
+if ((he -> ELrefcnt -= 1) == 0)
makefree((Freenode*)he, &hfl);
return ((struct Halfedge *) NULL);
-}
+}
struct Halfedge * VoronoiDiagramGenerator::ELleftbnd(struct Point *p)
{
int i, bucket;
struct Halfedge *he;
-
+
/* Use hash table to get close to desired halfedge */
bucket = (int)((p->x - xmin)/deltax * ELhashsize);//use the hash
function to find the place in the hash map that this HalfEdge should be
@@ -214,12 +218,12 @@
he = ELgethash(bucket);
if(he == (struct Halfedge *) NULL)//if the HE isn't found,
search backwards and forwards in the hash map for the first non-null entry
-{
+{
for(i=1; 1 ; i += 1)
-{
-if ((he=ELgethash(bucket-i)) != (struct Halfedge *) NULL)
+{
+if ((he=ELgethash(bucket-i)) != (struct Halfedge *) NULL)
break;
-if ((he=ELgethash(bucket+i)) != (struct Halfedge *) NULL)
+if ((he
SF.net SVN: matplotlib:[6863] trunk/matplotlib/doc/sphinxext
Revision: 6863
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6863&view=rev
Author: jdh2358
Date: 2009-02-02 12:42:08 + (Mon, 02 Feb 2009)
Log Message:
---
addplied Fernando's sphinxext patch
Modified Paths:
--
trunk/matplotlib/doc/sphinxext/inheritance_diagram.py
trunk/matplotlib/doc/sphinxext/ipython_console_highlighting.py
trunk/matplotlib/doc/sphinxext/mathmpl.py
trunk/matplotlib/doc/sphinxext/only_directives.py
Modified: trunk/matplotlib/doc/sphinxext/inheritance_diagram.py
===
--- trunk/matplotlib/doc/sphinxext/inheritance_diagram.py 2009-02-02
08:29:18 UTC (rev 6862)
+++ trunk/matplotlib/doc/sphinxext/inheritance_diagram.py 2009-02-02
12:42:08 UTC (rev 6863)
@@ -42,6 +42,17 @@
from docutils.parsers.rst import directives
from sphinx.roles import xfileref_role
+def my_import(name):
+"""Module importer - taken from the python documentation.
+
+This function allows importing names with dots in them."""
+
+mod = __import__(name)
+components = name.split('.')
+for comp in components[1:]:
+mod = getattr(mod, comp)
+return mod
+
class DotException(Exception):
pass
@@ -84,6 +95,13 @@
path = base
try:
module = __import__(path, None, None, [])
+# We must do an import of the fully qualified name. Otherwise if a
+# subpackage 'a.b' is requested where 'import a' does NOT provide
+# 'a.b' automatically, then 'a.b' will not be found below. This
+# second call will force the equivalent of 'import a.b' to happen
+# after the top-level import above.
+my_import(fullname)
+
except ImportError:
raise ValueError(
"Could not import class or module '%s' specified for
inheritance diagram" % name)
Modified: trunk/matplotlib/doc/sphinxext/ipython_console_highlighting.py
===
--- trunk/matplotlib/doc/sphinxext/ipython_console_highlighting.py
2009-02-02 08:29:18 UTC (rev 6862)
+++ trunk/matplotlib/doc/sphinxext/ipython_console_highlighting.py
2009-02-02 12:42:08 UTC (rev 6863)
@@ -1,18 +1,32 @@
+"""reST directive for syntax-highlighting ipython interactive sessions.
+"""
+
+#-
+# Needed modules
+
+# Standard library
+import re
+
+# Third party
from pygments.lexer import Lexer, do_insertions
-from pygments.lexers.agile import PythonConsoleLexer, PythonLexer, \
-PythonTracebackLexer
+from pygments.lexers.agile import (PythonConsoleLexer, PythonLexer,
+ PythonTracebackLexer)
from pygments.token import Comment, Generic
+
from sphinx import highlighting
-import re
+
+#-
+# Global constants
line_re = re.compile('.*?\n')
+#-
+# Code begins - classes and functions
+
class IPythonConsoleLexer(Lexer):
"""
For IPython console output or doctests, such as:
-Tracebacks are not currently supported.
-
.. sourcecode:: ipython
In [1]: a = 'foo'
@@ -24,7 +38,14 @@
foo
In [4]: 1 / 0
+
+Notes:
+
+ - Tracebacks are not currently supported.
+
+ - It assumes the default IPython prompts, not customized ones.
"""
+
name = 'IPython console session'
aliases = ['ipython']
mimetypes = ['text/x-ipython-console']
@@ -72,4 +93,6 @@
pylexer.get_tokens_unprocessed(curcode)):
yield item
+#-
+# Register the extension as a valid pygments lexer
highlighting.lexers['ipython'] = IPythonConsoleLexer()
Modified: trunk/matplotlib/doc/sphinxext/mathmpl.py
===
--- trunk/matplotlib/doc/sphinxext/mathmpl.py 2009-02-02 08:29:18 UTC (rev
6862)
+++ trunk/matplotlib/doc/sphinxext/mathmpl.py 2009-02-02 12:42:08 UTC (rev
6863)
@@ -1,3 +1,25 @@
+"""matplotlib-based directive for math rendering in reST using sphinx.
+
+To use this extension, add ``mathmpl`` to the list of extensions in
+:file:`conf.py`.
+
+Note:
+
+Current SVN versions of Sphinx now include built-in support for math.
+There are two flavors:
+
+ - pngmath: uses dvipng to render the equation
+
+ - jsmath: renders the math in the browser using Javascript
+
+To use these extensions instead of the code in this module, add
+``sphinx.ext.pngmath`` or ``sphinx.ext.jsmath`` to the list of extensions in
+:file:`conf.py` instead of ``mathmpl``.
+
+All three of these options for math are designed to behave in the same
+way.
+"""
+
import os
import s
