Three lectures render Chinese plot labels as tofu — no matplotlib font configuration
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 76/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- markdown, matplotlib, python
- Ambito
- data-visualization, documentation
Direzione di ricerca
Esamina divergence_measures.md, kesten_processes.md e jv.md, confrontando le relative sezioni di plotting con le 103 lezioni che utilizzano già il blocco di font standard dell’edizione. Controlla l’asset in lectures/fonts/SourceHanSerifSC-SemiBold.otf ed esegui il rendering delle figure interessate. Il lavoro è completo quando tutte e tre le lezioni configurano quel font prima del plotting e le loro etichette cinesi vengono renderizzate senza tofu.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Three lectures set Chinese text on matplotlib figures but carry no font configuration, so matplotlib falls back to DejaVu Sans, which has no CJK coverage. The labels render as tofu — blank rectangles — in a valid PNG, and nothing fails.
| Lecture | Chinese plot text | How it broke |
|---|---|---|
divergence_measures.md |
7 sites, e.g. plt.ylabel('密度'), axes[0].set_xlabel('KL散度 KL(f, g)') |
never had a block; labels hand-added 2025-09-12, after the blanket font pass |
kesten_processes.md |
4 sites, e.g. ax.set_ylabel("收益率"), ax.set_xlabel("日期") |
regression — block deleted by resync da7b176 (#190), labels kept |
jv.md |
via titles = [r"$s$策略", r"$\phi$策略", "价值函数"] |
block stripped by resync |
Fix
Add the edition's standard block to each, above first plotting use:
FONTPATH = "fonts/SourceHanSerifSC-SemiBold.otf"
mpl.font_manager.fontManager.addfont(FONTPATH)
plt.rcParams['font.family'] = ['Source Han Serif SC']
Note fonts/, not _fonts/ — this edition keeps the asset at lectures/fonts/SourceHanSerifSC-SemiBold.otf and the other 103 configured lectures all use that path.
Context
Not yet visible to readers: this edition last published 2025-11-06 and the breakage is post-dated, so the live site still serves pre-resync content. That is timing, not safety — it ships on the next publish.
Root cause and the recommendation against reverting to usetex are in the program review: project-translation reports/2026-07-24-cjk-font-rendering-review.md. Engine side is action-translation#107 — the resync drops i18n adaptations. A further ~12 lectures here use matplotlib with English labels and no config, which becomes tofu the moment anyone localises a label.
CI cannot currently catch any of this: the missing-glyph warning is raised in the kernel subprocess, so -W never sees it.
- Lingua principale
- TeX
- Stelle
- 5
- Fork
- 4
- Merge medio
- 18h 24m
- PR unite (30g)
- 2
Preparare l'ambiente
Non abbiamo ancora controllato i file di configurazione di questo progetto. Parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di QuantEcon/lecture-python.zh-cn
-
Phase 2 tidy-up: revert intersphinx-qualified references once their target lectures are translatedAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
QuantEcon/lecture-python.zh-cn#173 · 2 commenti ·
-
The -W gate is blind in ci.yml, and a warning-only cache failure discards a completed executionAperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
QuantEcon/lecture-python.zh-cn#271 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 28/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
QuantEcon/lecture-python.zh-cn#266 · 4 commenti ·
Tutte le issue di QuantEcon/lecture-python.zh-cn
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
E3SM-Project/e3sm_diags#1093 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
accessibility area:analytics beginner friendly community contributions-welcome difficulty:easy difficulty:medium enhancement feature good first issue hacktoberfest hactober-fest help wanted open-source
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
automated bug ready-for-agent severity: minor
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno