Skip to content

Commit

Permalink
Fix get_hinting_flag for Matplotlib 3.10.
Browse files Browse the repository at this point in the history
  • Loading branch information
anntzer committed Oct 29, 2024
1 parent 80b4fc2 commit 440e849
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
6 changes: 4 additions & 2 deletions ext/_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -862,9 +862,11 @@ std::vector<cairo_font_face_t*> 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<long>();
.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<long>();
}

void adjust_font_options(cairo_t* cr, bool subpixel_antialiased_text_allowed)
Expand Down

0 comments on commit 440e849

Please sign in to comment.