QuantEcon / QuantEcon/lecture-python-programming.fa
Persian figure labels in numba.md are unshaped and reversed — matplotlib does no Arabic shaping or bidi
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 1
- フォーク
- 1
- 平均マージ
- 10時間 5分
- マージ済み PR(30日)
- 5
説明
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.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
numba.md の 820-822 行目と environment.yml から始め、その後、他の翻訳版が非ラテン文字の図ラベルをどのように扱っているかを調べます。提案されている shaping の依存関係を、ラベルごとの方式、helper を使う方式、テキストを避ける方式と比較します。完了とは、プロジェクトにテスト済みで文書化された判断があり、shaping を採用する場合にペルシア語のラベルが正しくレンダリングされることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- data-visualization, internationalization
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100