|
1 | 1 | import io |
| 2 | +import pathlib |
2 | 3 |
|
3 | 4 | import numpy as np |
4 | 5 | from numpy.testing import assert_array_almost_equal |
|
7 | 8 |
|
8 | 9 |
|
9 | 10 | from matplotlib import ( |
10 | | - collections, path, pyplot as plt, transforms as mtransforms, rcParams) |
| 11 | + collections, path, pyplot as plt, transforms as mtransforms, rcParams, |
| 12 | + font_manager as fm |
| 13 | +) |
11 | 14 | from matplotlib.backends.backend_agg import RendererAgg |
12 | 15 | from matplotlib.figure import Figure |
13 | 16 | from matplotlib.image import imread |
14 | | -from matplotlib.path import Path |
15 | 17 | from matplotlib.testing.decorators import image_comparison |
16 | 18 | from matplotlib.transforms import IdentityTransform |
17 | 19 |
|
@@ -296,7 +298,7 @@ def chunk_limit_setup(): |
296 | 298 | gc.set_linewidth(1) |
297 | 299 | gc.set_foreground('r') |
298 | 300 | # make a Path |
299 | | - p = Path(np.vstack((x, y)).T) |
| 301 | + p = path.Path(np.vstack((x, y)).T) |
300 | 302 | # effectively disable path simplification (but leaving it "on") |
301 | 303 | p.simplify_threshold = 0 |
302 | 304 |
|
@@ -353,6 +355,10 @@ def test_chunksize_toobig_chunks(chunk_limit_setup): |
353 | 355 |
|
354 | 356 | @image_comparison(["font_fallback.png"]) |
355 | 357 | def test_font_fallback(): |
| 358 | + fp = fm.FontProperties(family=["WenQuanYi Zen Hei"]) |
| 359 | + if pathlib.Path(fm.findfont(fp)).name != "wqy-zenhei.ttc": |
| 360 | + pytest.skip("Font may be missing") |
| 361 | + |
356 | 362 | plt.rc('font', family=['DejaVu Sans', 'WenQuanYi Zen Hei'], size=15) |
357 | 363 |
|
358 | 364 | fig, ax = plt.subplots() |
|
0 commit comments