Skip to content

fonts: find CJK fonts on Windows, allow a GEO_FONT override - #13

Merged
Oldcircle merged 2 commits into
Oldcircle:mainfrom
cristianchiriac:windows-cjk-fonts
Oct 12, 2026
Merged

Oldcircle merged 2 commits into
Oldcircle:mainfrom
cristianchiriac:windows-cjk-fonts

Conversation

@cristianchiriac

Copy link
Copy Markdown
Contributor

What this changes

Fixes #11. _font() (in baidu_pano.py, used for every label and contact sheet) only searched macOS and Linux font paths. On Windows it fell back to ImageFont.load_default(), which has no CJK glyphs, so Chinese labels from evidence.py and the other sheets rendered as boxes.

It now also tries the standard Windows CJK fonts (msyh.ttc, simhei.ttf, simsun.ttc), and a GEO_FONT environment variable, checked first, can point at any other font file. That follows the existing GEO_PROXY. This is the patch @mengmengma0104 suggested in the issue, minus the bold Microsoft YaHei variant.

Tests: new FontTests in tests/test_runtime.py: the Windows fonts are tried, GEO_FONT comes first, and the first font that loads is used. On Windows 11, _font(40) now loads C:/Windows/Fonts/msyh.ttc and draws "机位" with real glyphs.

test_runtime.py: the 3 new tests pass. NetworkTests.test_model_route_overrides_ambient_variables fails on my Windows machine both before and after this change (environment variables are case-insensitive there), so it is unrelated.

Checklist

  • Every new claim in the docs maps to a command and a file it produces. (no doc changes)
  • New clues cite a source; new data files carry _meta (source, date, rows, licence). (n/a)
  • Scripts declare dependencies in the PEP 723 header and run with uv run. (no new dependencies)
  • Nothing here identifies a real person, a private home, or the answer to a specific case.
  • If README.md changed, README.zh-CN.md still matches its structure and numbers. (unchanged)

cristianchiriac and others added 2 commits October 12, 2026 00:29
_font() only searched macOS and Linux font paths, so on Windows it fell
back to ImageFont.load_default(), which has no CJK glyphs, and Chinese
labels in evidence sheets and contact sheets rendered as boxes. Try the
standard Windows CJK fonts too, and let GEO_FONT point at any other font.

Fixes #11
Keep the font override and regression tests from #13, and include the additional Windows font candidate proposed by @mengmengma0104 in #11 and #14.
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.

Windows: CJK labels render as tofu boxes in evidence/pano images — _font() has no Windows font paths

2 participants