8000 Svg fontweight fix by xwtang · Pull Request #3346 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Svg fontweight fix #3346

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

Closed
wants to merge 3 commits into from
Closed
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
SVG backend font-weight bug
font-weight is not properly saved to the svg file.
  • Loading branch information
xwtang committed Jul 26, 2014
commit 2e73697bcca41830e0fbb7b50b0474e48da52238
4 changes: 3 additions & 1 deletion lib/matplotlib/backends/backend_svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,7 @@ def _draw_text_as_text(self, gc, x, y, s, prop, angle, ismath, mtext=None):
style['font-size'] = six.text_type(fontsize) + 'px'
style['font-family'] = six.text_type(fontfamily)
style['font-style'] = prop.get_style().lower()
style['font-weight'] = prop.get_weight().lower()
attrib['style'] = generate_css(style)

if mtext and (angle == 0 or mtext.get_rotation_mode() == "anchor"):
Expand Down Expand Up @@ -1070,7 +1071,8 @@ def _draw_text_as_text(self, gc, x, y, s, prop, angle, ismath, mtext=None):
style = generate_css({
'font-size': six.text_type(fontsize) + 'px',
'font-family': font.family_name,
'font-style': font.style_name.lower()})
'font-style': font.style_name.lower(),
'font-weight': font.style_name.lower()})
if thetext == 32:
thetext = 0xa0 # non-breaking space
spans.setdefault(style, []).append((new_x, -new_y, thetext))
Expand Down
0