Skip to content

Fix CJK tofu on the three pages flagged by the post-publish sweep (ols, ar1_turningpts, phillips_credibility) - #244

Merged
mmcky merged 3 commits into
mainfrom
fix-ols-cjk-font-clobber
Aug 7, 2026
Merged

Fix CJK tofu on the three pages flagged by the post-publish sweep (ols, ar1_turningpts, phillips_credibility)#244
mmcky merged 3 commits into
mainfrom
fix-ols-cjk-font-clobber

Conversation

@mmcky

@mmcky mmcky commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

The 2026-08-07 publish (the first on this edition since 2025-11-06) fixed two of the three long-standing tofu pages (divergence_measures, stats_examples — stale builds) and surfaced the full picture on the pages whose defect is in the executed code. bin/check-tofu --site against the freshly published site flags exactly three pages; this PR fixes all three.

ols.mdsns.set_theme() runs ten lines after the font configuration and resets font.family to seaborn's defaults. Fixed by passing the font through set_theme(rc=...), seaborn's documented override mechanism.

ar1_turningpts.md — same clobber class through a third API: sns.set_style('white') also resets font.family. Same rc= override fix.

phillips_credibility.md — seeded with no font configuration at all (the QuantEcon/action-translation#178 sync-path localisation gap made visible). Adds the standard i18n block its sibling lectures carry.

Verification: the preview's three pages should show no Glyph … missing from font(s) stderr output; bin/check-tofu --site (program bench) against the preview should report all three clean. Part of the publish-gate work tracked in QuantEcon/project-translation#25 — after merge, the pages come clean on the next cache run + republish. Companion PR for the same class on programming.zh-cn: QuantEcon/lecture-python-programming.zh-cn#87.

🤖 Generated with Claude Code

sns.set_theme() runs ten lines after the i18n font cell and resets
font.family to seaborn's defaults, so every figure in the lecture ships
with tofu axis labels — live on the published site since 2025-11-06.
Passing the font family through set_theme's rc override keeps the theme
and the CJK font both.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 7, 2026 00:19
@netlify

netlify Bot commented Aug 7, 2026

Copy link
Copy Markdown

Deploy Preview for astonishing-narwhal-a8fc64 ready!

Name Link
🔨 Latest commit 6b6d6b7
🔍 Latest deploy log https://app.netlify.com/projects/astonishing-narwhal-a8fc64/deploys/6a7536343816e30008f93995
😎 Deploy Preview https://deploy-preview-244--astonishing-narwhal-a8fc64.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes missing CJK glyphs (“tofu” axis labels) in the ols lecture by preventing Seaborn from resetting Matplotlib’s configured Chinese font when sns.set_theme() is applied.

Changes:

  • Update lectures/ols.md to call sns.set_theme(rc=...) so font.family remains set to the intended CJK-capable font.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lectures/ols.md
from linearmodels.iv import IV2SLS
import seaborn as sns
sns.set_theme()
sns.set_theme(rc={'font.family': ['Source Han Serif SC', 'DejaVu Sans']}) # set_theme 会重置字体,用 rc 覆盖保留中文字体
The 2026-08-07 publish put both pages on the live site for the first
time, and bin/check-tofu flagged both. ar1_turningpts is the same
clobber class as ols through a third API: sns.set_style('white') resets
font.family after the i18n cell, so the rc override keeps the style and
the font both. phillips_credibility was seeded with no font
configuration at all (the action-translation#178 sync-path class); this
adds the standard i18n block used by its siblings.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mmcky mmcky changed the title Re-apply CJK font through sns.set_theme(rc=...) in ols Fix CJK tofu on the three pages flagged by the post-publish sweep (ols, ar1_turningpts, phillips_credibility) Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

@mmcky

mmcky commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Merge-order caveat: #230 in the open sync backlog re-delivers ar1_turningpts.md, and a sync regenerates the whole file — whichever merges second wins it. Since the sync path carries no localisation (action-translation#178), merging #230 after this PR silently reverts the ar1_turningpts font fix. Either merge this PR after #230, or expect to re-apply that one file. The ols and phillips_credibility fixes are untouched by the backlog.

@mmcky
mmcky merged commit bad7049 into main Aug 7, 2026
7 checks passed
@mmcky
mmcky deleted the fix-ols-cjk-font-clobber branch August 7, 2026 03:49
mmcky added a commit that referenced this pull request Aug 7, 2026
…ation ToC entry

The rebase automation's regenerated ToC reintroduced the undelivered
lecture (pattern on #210); main now supplies the #231 lectures and the
source bibliography, so the cross-PR references resolve by inheritance.
Zero dangling ToC entries verified. The remaining question for this
preview is whether the mccall_risk CellExecutionError reproduces — its
code is byte-identical to source, so a repeat points away from the
translation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants