matplotlib / matplotlib/mplcairo
Poor on-screen font antialiasing/smoothing in mplcairo
还没有人认领这个 Issue。
- 主要语言
- C++
- 星标
- 119
- 派生
- 23
- PR 合并指标
- 30 天内没有已合并 PR
描述
I'm trying to switch to using the mplcairo backend because it does certain things better than the MacOSX backend, especially when colormaps have transparency. However, I've noticed that the font smoothing, at least for plots displayed on the screen, is noticeably poorer. The code below offers a MWE:
import numpy as np
from matplotlib import pyplot as plt
fig = plt.figure()
plt.plot(np.linspace(0,1,10), np.linspace(0,1,10), '-o')
plt.setp(plt.gca().get_xticklabels(), size=14)
plt.setp(plt.gca().get_yticklabels(), size=14)
With the mplcairo backend, the tick labels look jagged and not smooth, as below.
Whereas with the MacOSX backend gives me noticeably smoother fonts.
Everything is identical for the production of the two figures except the backend, which I switch in .matplotlibrc. Am I missing something? Is there a way to get mplcairo to render fonts with proper smoothing?
import mplcairo
mplcairo.get_versions()
{'python': '3.11.6 (main, Oct 12 2023, 21:46:57) [Clang 15.0.0 (clang-1500.0.40.1)]',
'mplcairo': '0.5.post32+ge771c74',
'matplotlib': '3.8.0',
'cairo': '1.17.6 @ /Users/sbasu1/packages/macports/lib/libcairo.2.dylib',
'freetype': '2.13.2 @ /Users/sbasu1/packages/macports/lib/libfreetype.6.dylib',
'pybind11': '2.11.1',
'raqm': None,
'harfbuzz': None}
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,使用 mplcairo 和 MacOSX 后端运行提供的 Python MWE,并将报告的 mplcairo、Matplotlib、Cairo 和 FreeType 版本作为参考。比较屏幕上的文本渲染效果,并调查后端的字体渲染路径。完成的标准是确定是否支持等效的平滑处理,并对其进行改进,或清楚地记录该限制和可用的配置。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- computer-graphics, desktop
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 30/100