Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3fb5c1b

Browse files
author
Steve Chaplin
committed
SC 10/12/2004
svn path=/trunk/matplotlib/; revision=745
1 parent bb7b9fc commit 3fb5c1b

1 file changed

Lines changed: 4 additions & 13 deletions

File tree

lib/matplotlib/backends/backend_gdk.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,7 @@ def fn_name(): return sys._getframe(1).f_code.co_name
1717
FigureManagerBase, FigureCanvasBase, error_msg
1818
from matplotlib._matlab_helpers import Gcf
1919
from matplotlib.figure import Figure
20-
21-
try: from matplotlib.mathtext import math_parse_s_ft2font
22-
except ImportError:
23-
verbose.report_error('backend_gtk could not import mathtext (build with ft2font)')
24-
useMathText = False
25-
else: useMathText = True
20+
from matplotlib.mathtext import math_parse_s_ft2font
2621

2722
pygtk_version_required = (1,99,16)
2823
try:
@@ -205,17 +200,15 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath):
205200

206201

207202
def _draw_mathtext(self, gc, x, y, s, prop, angle):
208-
209203
size = prop.get_size_in_points()
210204
width, height, fonts = math_parse_s_ft2font(
211205
s, self.dpi.get(), size)
212206

213207
if angle==90:
214208
width, height = height, width
209+
x -= width
210+
y -= height
215211

216-
rgb = gc.get_rgb()
217-
#rgba = (rgb[0], rgb[1], rgb[2], gc.get_alpha())
218-
219212
imw, imh, s = fonts[0].image_as_str()
220213
N = imw*imh
221214

@@ -245,14 +238,12 @@ def _draw_mathtext(self, gc, x, y, s, prop, angle):
245238
verbose.report_error('mathtext not supported: %s' % exc)
246239
return
247240

241+
rgb = gc.get_rgb()
248242
pa[:,:,0]=int(rgb[0]*255)
249243
pa[:,:,1]=int(rgb[1]*255)
250244
pa[:,:,2]=int(rgb[2]*255)
251245
pa[:,:,3]=Xs
252246

253-
if angle==90:
254-
x -= width
255-
y -= height
256247
pb.render_to_drawable(self.gdkDrawable, gc.gdkGC, 0, 0,
257248
int(x), int(y), imw, imh,
258249
gdk.RGB_DITHER_NONE, 0, 0)

0 commit comments

Comments
 (0)