Mathtext rendering fails with Matplotlib 3.11: glyph tuples now contain six fields
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 72/100
Hướng nghiên cứu
Start by tracing how mplcairo handles MathTextParser("path").parse(...).glyphs and compare its expected tuples with Matplotlib 3.11's six-field tuples. Use the reproducer to confirm the rendering failure, then check both canvas drawing and MultiPage PDF output. Done means the mathtext annotation renders and multipage saving succeeds with Matplotlib 3.11.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Bug summary
Rendering a figure containing mathtext with mplcairo 0.6.1 and
Matplotlib 3.11.2 fails with a C++ type-casting error. This also
affects saving such figures with mplcairo.multipage.MultiPage.
Reproducer
import matplotlib
matplotlib.use("module://mplcairo.base")
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot([1, 2])
ax.annotate(r"$\sigma_f=1.4\times 10^{-8}$", (1, 1))
fig.canvas.draw()
Actual result
RuntimeError: Unable to cast Python instance of type <class 'tuple'>
to C++ type '?' (#define PYBIND11_DETAILED_ERROR_MESSAGES or
compile in debug mode for details)
Expected result
The figure renders with the mathtext annotation.
Likely cause
Matplotlib 3.11 added a glyph index to each tuple in
MathTextParser("path").parse(...).glyphs. The tuples now contain:
(font, fontsize, character_code, glyph_index, x, y)
The mplcairo renderer appears to cast each tuple to the previous
five-field form. Matplotlib documents the change here:
As a local experiment, adapting the parser result to remove the added
glyph-index field allowed both canvas rendering and multipage PDF
output to complete. This was a compatibility experiment, not a
tested upstream patch.
Environment
Python: 3.15.2
Matplotlib: 3.11.2
mplcairo: 0.6.1
Fedora Linux 45
- Ngôn ngữ chính
- C++
- Star
- 120
- Fork
- 23
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của matplotlib/mplcairo
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
matplotlib/mplcairo#55 · 18 bình luận ·
-
workaround for low dpi when rasterizing (pcolormesh saved as pdf)Có thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
matplotlib/mplcairo#19 · 5 bình luận ·
Tất cả issue của matplotlib/mplcairo
Issue tương tự
-
[Bug] Windows 文件传输无法打开含中文的本机主目录Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 1 ngày
-
? - Needs Triage bot_watch bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NVIDIA/cudf-spark-jni#5594 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Branch-master
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
TrinityCore/TrinityCore#32177 ·
Maintainer thường phản hồi trong vòng 10 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
mw00/project-maya#1499 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày