QuantEcon / QuantEcon/lecture-python-programming.fa
Persian figure labels in numba.md are unshaped and reversed — matplotlib does no Arabic shaping or bidi
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- Python
- Estrelas
- 1
- Forks
- 1
- Merge médio
- 10h 5min
- PRs com merge (30d)
- 5
Descrição
numba.md sets Persian text on matplotlib figures — ax.set_xlabel('تعداد نمونهها') at line 820 and ax.set_ylabel(r'تخمین $\pi$') at 822, introduced by sync commit 7cd985b — and this repo carries no matplotlib font configuration and no font assets at all.
This is not the same problem as the Chinese editions, and it must not get the same fix. The glyphs do render: DejaVu Sans, matplotlib's default, covers all 29 codepoints involved. What fails is shaping. matplotlib performs no Arabic contextual shaping and no bidirectional reordering, so the label comes out as isolated letterforms in left-to-right order — legible as individual characters, wrong as Persian text. Swapping in a Persian font would not help, because the defect is in the text-layout stage rather than in glyph coverage.
Fix
The conventional approach is to reshape and reorder the string before it reaches matplotlib:
arabic-reshaperto apply contextual formspython-bidito apply the Unicode bidirectional algorithm
Both would need adding to environment.yml. Worth deciding whether to apply this per-label, via a small helper, or to avoid Persian in figure text altogether for now — the third option is legitimate and is what the rest of this edition currently does by default.
How it was found
A survey of CJK font handling across the translation program (project-translation reports/2026-07-24-cjk-font-rendering-review.md) checked the non-Latin editions for the same class of defect. This is the only instance in .fa; the .fr edition needs nothing, since DejaVu covers Latin with accents and French needs no shaping.
Filed for a decision rather than as an urgent break — one lecture, and the text is present rather than absent.
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Comece pelas linhas 820-822 de numba.md e environment.yml e, em seguida, examine como outras edições traduzidas lidam com rótulos de figuras não latinos. Compare as dependências de shaping propostas com as opções por rótulo, de helper e de evitar texto; considera-se concluído quando o projeto tiver uma decisão testada e documentada e os rótulos em persa forem renderizados corretamente caso o shaping seja adotado.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- python
- Domínio
- data-visualization, internationalization
- Tipo de issue
- Bug
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Pouca atividade
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 48/100