Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Font advance width#4031

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tacaswell merged 3 commits intomatplotlib:masterfrommdboom:font-advance-width
Feb 19, 2015
Merged
Show file tree
Hide file tree
Changes fromall 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
  •  
  •  
  •  
3 changes: 3 additions & 0 deletionsCHANGELOG
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
2015-01-23 Text bounding boxes are now computed with advance width rather than
ink area. This may result in slightly different placement of text.

2014-10-27 Allowed selection of the backend using the `MPLBACKEND` environment
variable. Added documentation on backend selection methods.

Expand Down
5 changes: 4 additions & 1 deletionlib/matplotlib/backends/backend_agg.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -202,12 +202,15 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
font.draw_glyphs_to_bitmap(antialiased=rcParams['text.antialiased'])
d = font.get_descent() / 64.0
# The descent needs to be adjusted for the angle
xo, yo = font.get_bitmap_offset()
xo /= 64.0
yo /= 64.0
xd = -d * np.sin(np.deg2rad(angle))
yd = d * np.cos(np.deg2rad(angle))

#print x, y, int(x), int(y), s
self._renderer.draw_text_image(
font, np.round(x - xd), np.round(y + yd) + 1, angle, gc)
font, np.round(x - xd + xo), np.round(y + yd + yo) + 1, angle, gc)

def get_text_width_height_descent(self, s, prop, ismath):
"""
Expand Down
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
130 changes: 67 additions & 63 deletionslib/matplotlib/tests/baseline_images/test_axes/axhspan_epoch.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
130 changes: 67 additions & 63 deletionslib/matplotlib/tests/baseline_images/test_axes/axvspan_epoch.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modifiedlib/matplotlib/tests/baseline_images/test_axes/boxplot.pdf
View file
Open in desktop
Binary file not shown.
Binary file modifiedlib/matplotlib/tests/baseline_images/test_axes/boxplot.png
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

[8]ページ先頭

©2009-2025 Movatter.jp