Skip to content

Commit c784919

Browse files
committed
Add PS test for multiple fonttypes
1 parent e8ce760 commit c784919

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/matplotlib/tests/test_backend_ps.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,18 @@ def test_type42_font_without_prep():
207207
mpl.rcParams["mathtext.fontset"] = "stix"
208208

209209
plt.figtext(0.5, 0.5, "Mass $m$")
210+
211+
212+
@pytest.mark.parametrize('fonttype', ["3", "42"])
213+
def test_fonttype(fonttype):
214+
mpl.rcParams["ps.fonttype"] = fonttype
215+
fig, ax = plt.subplots()
216+
217+
ax.text(0.25, 0.5, "Forty-two is the answer to everything!")
218+
219+
buf = io.BytesIO()
220+
fig.savefig(buf, format="ps")
221+
222+
test = b'/FontType ' + bytes(f"{fonttype}", encoding='utf-8') + b' def'
223+
224+
assert re.search(test, buf.getvalue(), re.MULTILINE)

0 commit comments

Comments
 (0)