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

Commit980fbee

Browse files
committed
Add missing decode() in svg font embedding path.
Otherwise, rcParams["svg.fonttype"] = "svgfont"; title("foo"); savefig("/tmp/test.svg")fails (on Py3) with File ".../backend_svg.py", line 86, in escape_attrib s = s.replace("&", "&") TypeError: a bytes-like object is required, not 'str'The encoding of entry 1, 0, 0, 4 in the sfnt table is macroman(https://www.freetype.org/freetype2/docs/reference/ft2-truetype_tables.html#TT_MAC_ID_XXX).Note that after the fix is applied, the resulting svg file still appearsto be unopenable by inkscape, so the fix is not complete, but hopefullya step in the correct direction.
1 parent7a6bab7 commit980fbee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎lib/matplotlib/backends/backend_svg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ def _write_svgfonts(self):
506506
font=get_font(font_fname)
507507
font.set_size(72,72)
508508
sfnt=font.get_sfnt()
509-
writer.start('font',id=sfnt[(1,0,0,4)])
509+
writer.start('font',id=sfnt[1,0,0,4].decode("macroman"))
510510
writer.element(
511511
'font-face',
512512
attrib={

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp