|
From: <md...@us...> - 2007-08-08 17:41:31
|
Revision: 3687
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3687&view=rev
Author: mdboom
Date: 2007-08-08 10:41:30 -0700 (Wed, 08 Aug 2007)
Log Message:
-----------
Improve horizontal lines in mathtext in Agg backend.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/mathtext.py
trunk/matplotlib/src/ft2font.cpp
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-08-08 16:52:44 UTC (rev 3686)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-08-08 17:41:30 UTC (rev 3687)
@@ -254,10 +254,8 @@
def render_rect_filled(self, x1, y1, x2, y2):
font = self.fonts_object.get_fonts()[0]
font.draw_rect_filled(
- floor(max(0, x1 - 1)),
- floor(y1),
- ceil(max(x2 - 1, x1)),
- ceil(max(y2 - 1, y1)))
+ int(x1 + 0.5), int(y1 + 0.5) - 1,
+ int(x2 - 0.5), int(y2 - 0.5) - 1)
def get_results(self):
return (self.width,
@@ -282,12 +280,12 @@
%(fontsize)s scalefont
setfont
%(ox)f %(oy)f moveto
-/%(symbol_name)s glyphshow
+/%(symbol_name)s glyphshow\n
""" % locals()
self.pswriter.write(ps)
def render_rect_filled(self, x1, y1, x2, y2):
- ps = "%f %f %f %f rectfill" % (x1, self.height - y2, x2 - x1, y2 - y1)
+ ps = "%f %f %f %f rectfill\n" % (x1, self.height - y2, x2 - x1, y2 - y1)
self.pswriter.write(ps)
def get_results(self):
Modified: trunk/matplotlib/src/ft2font.cpp
===================================================================
--- trunk/matplotlib/src/ft2font.cpp 2007-08-08 16:52:44 UTC (rev 3686)
+++ trunk/matplotlib/src/ft2font.cpp 2007-08-08 17:41:30 UTC (rev 3687)
@@ -1043,16 +1043,11 @@
FT_Int iwidth = (FT_Int)image.width;
FT_Int iheight = (FT_Int)image.height;
- if ( x0<0 || y0<0 || x1<0 || y1<0 ||
- x0>iwidth || x1>iwidth ||
- y0>iheight || y1>iheight )
- throw Py::ValueError("Rect coords outside image bounds");
+ x0 = CLAMP(x0, 0, iwidth);
+ y0 = CLAMP(y0, 0, iheight);
+ x1 = CLAMP(x1, 0, iwidth);
+ y1 = CLAMP(y1, 0, iheight);
- //~ for (long j=y0; j<y1; ++j) {
- //~ for (long i=x0; i<x1+1; ++i) {
- //~ image.buffer[i + j*iwidth] = 255;
- //~ }
- //~ }
for (long j=y0; j<y1+1; j++) {
for (long i=x0; i<x1+1; i++) {
image.buffer[i + j*iwidth] = 255;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|