Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Poor on-screen font antialiasing/smoothing in mplcairo

Aperta
#55 18 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python

Direzione di ricerca

Inizia eseguendo l'MWE Python fornito con i backend mplcairo e MacOSX, usando come riferimento le versioni indicate di mplcairo, Matplotlib, Cairo e FreeType. Confronta il rendering del testo sullo schermo e analizza il percorso di rendering dei font del backend. Il lavoro è completato quando è stato stabilito se è supportato uno smoothing equivalente e questo è stato migliorato oppure sono stati documentati chiaramente il limite e la configurazione disponibile.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.
Screenshot 2023-12-28 at 4 32 03 PM
Whereas with the MacOSX backend gives me noticeably smoother fonts.
Screenshot 2023-12-28 at 4 33 00 PM

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}
Lingua principale
C++
Stelle
119
Fork
23
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di matplotlib/mplcairo

Tutte le issue di matplotlib/mplcairo

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.