8000 incorrect bbox of text by mdboom · Pull Request #2070 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

incorrect bbox of text #2070

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 29, 2013
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix Issue #2060: Text bbox alignment
  • Loading branch information
mdboom committed May 29, 2013
commit 4c61dc714ceb778daa28af5f5a8c3d647d45d301
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 1 addition & 4 deletions lib/matplotlib/offsetbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Binary file modified lib/matplotlib/tests/baseline_images/test_axes/markevery.pdf
Binary file not shown.
Binary file modified lib/matplotlib/tests/baseline_images/test_axes/markevery.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
526 changes: 263 additions & 263 deletions lib/matplotlib/tests/baseline_images/test_axes/markevery.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/matplotlib/tests/baseline_images/test_axes/markevery_line.pdf
Binary file not shown.
Binary file modified lib/matplotlib/tests/baseline_images/test_axes/markevery_line.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
550 changes: 275 additions & 275 deletions lib/matplotlib/tests/baseline_images/test_axes/markevery_line.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
0