Skip to content

Commit 440e849

Browse files
committed
Fix get_hinting_flag for Matplotlib 3.10.
1 parent 80b4fc2 commit 440e849

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGELOG.rst

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ next
22
====
33

44
- Bumped dependencies to Python≥3.8.
5+
- Fixed compatibility with Matplotlib≥3.10.
56
- Fixed support for macos backend on Matplotlib≥3.6.
67
- Fixed compatibility with wheel≥0.41.
78
- Support pdf MaxVersion up to 1.7 (if the underlying cairo supports it).

ext/_util.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -862,9 +862,11 @@ std::vector<cairo_font_face_t*> font_faces_from_prop(py::object prop)
862862
long get_hinting_flag()
863863
{
864864
// FIXME[matplotlib]: Should be moved out of backend_agg.
865-
return
865+
auto const& hf =
866866
py::module::import("matplotlib.backends.backend_agg")
867-
.attr("get_hinting_flag")().cast<long>();
867+
.attr("get_hinting_flag")();
868+
// Matplotlib 3.10 changed the flag from int to enum.Flag.
869+
return (py::hasattr(hf, "value") ? hf.attr("value") : hf).cast<long>();
868870
}
869871

870872
void adjust_font_options(cairo_t* cr, bool subpixel_antialiased_text_allowed)

0 commit comments

Comments
 (0)