Permalink
Browse files

Fix Issue #2060: Text bbox alignment

  • Loading branch information...
1 parent 33faad1 commit 4c61dc714ceb778daa28af5f5a8c3d647d45d301 @mdboom committed May 28, 2013
@@ -235,7 +235,7 @@ def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!', mtext=None):
w, h, d = self.get_text_width_height_descent(s, prop, ismath)
xd = d * np.sin(np.deg2rad(angle))
yd = d * np.cos(np.deg2rad(angle))
- x = np.round(x - xd)
+ x = np.round(x + xd)
y = np.round(y + yd)
self._renderer.draw_text_image(Z, x, y, angle, gc)
@@ -718,13 +718,10 @@ def get_extent(self, renderer):
_, h_, d_ = renderer.get_text_width_height_descent(
"lp", self._text._fontproperties, ismath=False)
- bbox, info = self._text._get_layout(renderer)
+ bbox, info, d = self._text._get_layout(renderer)
w, h = bbox.width, bbox.height
line = info[-1][0] # last line
- _, hh, dd = renderer.get_text_width_height_descent(
- line, self._text._fontproperties, ismath=ismath)
- d = dd # the baseline of the last line
self._baseline_transform.clear()
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.

0 comments on commit 4c61dc7

Please sign in to comment.