Three lectures render Chinese plot labels as tofu — no matplotlib font configuration
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 76/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Tranquilo
- Stack tecnológico
- markdown, matplotlib, python
Línea de trabajo
Inspecciona divergence_measures.md, kesten_processes.md y jv.md, comparando sus secciones de plotting con las 103 lecciones que ya utilizan el bloque de fuente estándar de la edición. Comprueba el asset en lectures/fonts/SourceHanSerifSC-SemiBold.otf y renderiza las figuras afectadas. La tarea estará terminada cuando las tres lecciones configuren esa fuente antes de hacer plotting y sus etiquetas en chino se rendericen sin tofu.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TeX
- Estrellas
- 5
- Forks
- 4
- Merge medio
- 18 h 24 min
- PR fusionados (30 d)
- 2
Preparar el entorno
Aún no hemos revisado los archivos de configuración de este proyecto. Empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de QuantEcon/lecture-python.zh-cn
-
Phase 2 tidy-up: revert intersphinx-qualified references once their target lectures are translatedAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
QuantEcon/lecture-python.zh-cn#173 · 2 comentarios ·
-
The -W gate is blind in ci.yml, and a warning-only cache failure discards a completed executionAbierto
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
QuantEcon/lecture-python.zh-cn#271 · 1 comentario ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 28/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
QuantEcon/lecture-python.zh-cn#266 · 4 comentarios ·
Todos los issues de QuantEcon/lecture-python.zh-cn
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
legend_group raises TypeError when the grouped column contains None (or NaN) alongside stringsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
PedestrianDynamics/pyFDS-Evac#228 ·
Los mantenedores suelen responder en 1 día