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 all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 6 additions & 4 deletions doc/users/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ so that search results are printed prettily:
'ytick.major.size': 4,
'ytick.minor.size': 2})

Better vertical text alignment
------------------------------
Better vertical text alignment and multi-line text
--------------------------------------------------

The vertical alignment of text is now consistent across backends. You
may see small differences in text placement, particularly with rotated
Expand All @@ -241,6 +241,9 @@ If you are using a custom backend, note that the `draw_text` renderer
method is now passed the location of the baseline, not the location of
the bottom of the text bounding box.

Multi-line text will now leave enough room for the height of very tall
or very low text, such as superscripts and subscripts.

``savefig.jpeg_quality`` added to rcParams
------------------------------------------------------------------------------
``rcParam`` value ``savefig.jpeg_quality`` was added so that the user can
Expand Down Expand Up @@ -1152,6 +1155,5 @@ Here are the 0.98.4 notes from the CHANGELOG::
arrays are now converted to arrays with NaNs for consistent
handling of masks and NaNs - MGD and EF

Added support for arbitrary rasterization resolutions to the SVG
Added support for arbitrary rasterization resolutions to the SVG
backend. - MW

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