SF.net SVN: matplotlib: [4985] trunk/matplotlib/lib/matplotlib/mathtext.py

2008-02-21 Thread mdboom
Revision: 4985
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4985&view=rev
Author:   mdboom
Date: 2008-02-21 11:13:14 -0800 (Thu, 21 Feb 2008)

Log Message:
---
Remove case-sensitivity for backend selection.  (Not a user-visible problem)

Modified Paths:
--
trunk/matplotlib/lib/matplotlib/mathtext.py

Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===
--- trunk/matplotlib/lib/matplotlib/mathtext.py 2008-02-20 14:11:59 UTC (rev 
4984)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py 2008-02-21 19:13:14 UTC (rev 
4985)
@@ -2656,12 +2656,12 @@
 _parser = None
 
 _backend_mapping = {
-'Bitmap': MathtextBackendBitmap,
-'Agg'   : MathtextBackendAgg,
-'PS': MathtextBackendPs,
-'Pdf'   : MathtextBackendPdf,
-'SVG'   : MathtextBackendSvg,
-'Cairo' : MathtextBackendCairo
+'bitmap': MathtextBackendBitmap,
+'agg'   : MathtextBackendAgg,
+'ps': MathtextBackendPs,
+'pdf'   : MathtextBackendPdf,
+'svg'   : MathtextBackendSvg,
+'cairo' : MathtextBackendCairo
 }
 
 _font_type_mapping = {
@@ -2672,7 +2672,7 @@
 }
 
 def __init__(self, output):
-self._output = output
+self._output = output.lower()
 self._cache = maxdict(50)
 
 def parse(self, s, dpi = 72, prop = None):
@@ -2689,7 +2689,7 @@
 else:
 backend = self._backend_mapping[self._output]()
 fontset = rcParams['mathtext.fontset']
-fontset_class = self._font_type_mapping.get(fontset)
+fontset_class = self._font_type_mapping.get(fontset.lower())
 if fontset_class is not None:
 font_output = fontset_class(prop, backend)
 else:


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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4986] trunk/matplotlib/src/_path.cpp

2008-02-21 Thread mdboom
Revision: 4986
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4986&view=rev
Author:   mdboom
Date: 2008-02-21 11:13:46 -0800 (Thu, 21 Feb 2008)

Log Message:
---
Formatting and minor efficiency improvement.

Modified Paths:
--
trunk/matplotlib/src/_path.cpp

Modified: trunk/matplotlib/src/_path.cpp
===
--- trunk/matplotlib/src/_path.cpp  2008-02-21 19:13:14 UTC (rev 4985)
+++ trunk/matplotlib/src/_path.cpp  2008-02-21 19:13:46 UTC (rev 4986)
@@ -921,7 +921,7 @@
 }
 
 result = (PyArrayObject*)PyArray_SimpleNew
- (PyArray_NDIM(vertices), PyArray_DIMS(vertices), 
PyArray_DOUBLE);
+  (PyArray_NDIM(vertices), PyArray_DIMS(vertices), PyArray_DOUBLE);
 if (PyArray_NDIM(vertices) == 2)
 {
 size_t n = PyArray_DIM(vertices, 0);
@@ -1017,17 +1017,17 @@
 return Py::Int(count);
 }
 
-bool segments_intersect(const double& x1, const double &y1,
-const double& x2, const double &y2,
-const double& x3, const double &y3,
-const double& x4, const double &y4)
+bool segments_intersect(const double& x1, const double& y1,
+const double& x2, const double& y2,
+const double& x3, const double& y3,
+const double& x4, const double& y4)
 {
-double den = ((y4-y3) * (x2-x1)) - ((x4-x3)*(y2-y1));
+double den = ((y4-y3)*(x2-x1)) - ((x4-x3)*(y2-y1));
 if (den == 0.0)
 return false;
 
-double n1 = ((x4-x3) * (y1-y3)) - ((y4-y3)*(x1-x3));
-double n2 = ((x2-x1) * (y1-y3)) - ((y2-y1)*(x1-x3));
+double n1 = ((x4-x3)*(y1-y3)) - ((y4-y3)*(x1-x3));
+double n2 = ((x2-x1)*(y1-y3)) - ((y2-y1)*(x1-x3));
 
 double u1 = n1/den;
 double u2 = n2/den;
@@ -1075,20 +1075,9 @@
 PathIterator p1(args[0]);
 PathIterator p2(args[1]);
 
-bool intersects = ::path_intersects_path(p1, p2);
-if (!intersects)
-{
-intersects = ::path_in_path(p1, agg::trans_affine(), p2, 
agg::trans_affine());
-if (!intersects)
-{
-intersects = ::path_in_path(p2, agg::trans_affine(), p1, 
agg::trans_affine());
-if (!intersects)
-{
-return Py::Int(0);
-}
-}
-}
-return Py::Int(1);
+return Py::Int(::path_intersects_path(p1, p2)
+   || ::path_in_path(p1, agg::trans_affine(), p2, 
agg::trans_affine())
+   || ::path_in_path(p2, agg::trans_affine(), p1, 
agg::trans_affine()));
 }
 
 void _add_polygon(Py::List& polygons, const std::vector& polygon) {


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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins