diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8fb79bb9..8c5c2b58 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,7 @@ next ==== - Bumped dependencies to Python≥3.8. +- Fixed compatibility with Matplotlib≥3.10. - Fixed support for macos backend on Matplotlib≥3.6. - Fixed compatibility with wheel≥0.41. - Support pdf MaxVersion up to 1.7 (if the underlying cairo supports it). diff --git a/ext/_util.cpp b/ext/_util.cpp index e150d6c1..a49738c1 100644 --- a/ext/_util.cpp +++ b/ext/_util.cpp @@ -862,9 +862,11 @@ std::vector font_faces_from_prop(py::object prop) long get_hinting_flag() { // FIXME[matplotlib]: Should be moved out of backend_agg. - return + auto const& hf = py::module::import("matplotlib.backends.backend_agg") - .attr("get_hinting_flag")().cast(); + .attr("get_hinting_flag")(); + // Matplotlib 3.10 changed the flag from int to enum.Flag. + return (py::hasattr(hf, "value") ? hf.attr("value") : hf).cast(); } void adjust_font_options(cairo_t* cr, bool subpixel_antialiased_text_allowed)