Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/matplotlib/afm.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ def _parse_char_metrics(fh):
# Reference).
if name == 'Euro':
num = 128
elif name == 'minus':
num = ord("\N{MINUS SIGN}") # 0x2212
if num != -1:
ascii_d[num] = metrics
name_d[name] = metrics
Expand Down
12 changes: 6 additions & 6 deletions lib/matplotlib/tests/test_backend_ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@
'eps afm',
'eps with usetex'
])
def test_savefig_to_stringio(format, use_log, rcParams):
def test_savefig_to_stringio(format, use_log, rcParams, monkeypatch):
mpl.rcParams.update(rcParams)
monkeypatch.setenv("SOURCE_DATE_EPOCH", "0") # For reproducibility.

fig, ax = plt.subplots()

Expand All @@ -56,17 +57,16 @@ def test_savefig_to_stringio(format, use_log, rcParams):
ax.set_yscale('log')

ax.plot([1, 2], [1, 2])
ax.set_title("Déjà vu")
title = "Déjà vu"
if not mpl.rcParams["text.usetex"]:
title += " \N{MINUS SIGN}\N{EURO SIGN}"
ax.set_title(title)
fig.savefig(s_buf, format=format)
fig.savefig(b_buf, format=format)

s_val = s_buf.getvalue().encode('ascii')
b_val = b_buf.getvalue()

# Remove comments from the output. This includes things that could
# change from run to run, such as the time.
s_val, b_val = [re.sub(b'%%.*?\n', b'', x) for x in [s_val, b_val]]

assert s_val == b_val.replace(b'\r\n', b'\n')


Expand Down