Skip to content

fix(FR-2745): fix PDF font selection for Japanese and Thai builds on macOS#7068

Open
agatha197 wants to merge 1 commit intomainfrom
04-27-fix_fr-2745_fix_pdf_font_selection_for_japanese_and_thai_builds_on_macos
Open

fix(FR-2745): fix PDF font selection for Japanese and Thai builds on macOS#7068
agatha197 wants to merge 1 commit intomainfrom
04-27-fix_fr-2745_fix_pdf_font_selection_for_japanese_and_thai_builds_on_macos

Conversation

@agatha197
Copy link
Copy Markdown
Contributor

@agatha197 agatha197 commented Apr 27, 2026

Resolves #7067 (FR-2745)

Summary

  • Split CJK_FONT_CANDIDATES into language-specific lists: KO_FONT_CANDIDATES (Nanum first for better Hangul) and JA_ZH_FONT_CANDIDATES (Arial Unicode first for Kana/Han coverage)
  • Add macOS Thonburi.ttc as the first candidate in THAI_FONT_CANDIDATES (was Linux-only before)
  • Update loadStampFallbackFonts selection logic to use KO_LANGS / JA_ZH_LANGS / THAI_LANGS sets
  • Improve warning messages with language-specific installation hints

Root Cause

Two issues on macOS:

  1. Japanese: NanumBarunGothic.ttf (Korean-only, user-installed) appeared before Arial Unicode.ttf in CJK_FONT_CANDIDATES. The renderer stops at the first successfully loaded font (break), so Japanese builds loaded a Korean-only font that cannot encode Katakana glyphs → WinAnsi cannot encode "セ".

  2. Thai: THAI_FONT_CANDIDATES contained only Linux paths (/usr/share/fonts/truetype/tlwg/). No macOS Thai font was listed → fell back to Helvetica → WinAnsi cannot encode "ว".

Verification

  • pnpm run pdf:jaStamp font loaded: Arial Unicode.ttf — no encoding errors
  • pnpm run pdf:thStamp font loaded: Thonburi.ttc — no encoding errors
  • Linux CI unaffected — NotoSansCJK TTC and TLWG paths remain in candidate lists

…macOS

On macOS, Japanese builds failed because user-installed NanumBarunGothic
(Korean-only) was loaded before Arial Unicode in CJK_FONT_CANDIDATES,
and Thai builds failed because THAI_FONT_CANDIDATES had no macOS paths.

Split CJK candidates into language-specific lists so Japanese/Chinese
prioritize Arial Unicode (broad CJK coverage) while Korean keeps Nanum
for better Hangul rendering. Add macOS Thonburi.ttc to Thai candidates.
@github-actions github-actions Bot added the size:M 30~100 LoC label Apr 27, 2026
Copy link
Copy Markdown
Contributor Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • flow:merge-queue - adds this PR to the back of the merge queue
  • flow:hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has required the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@agatha197 agatha197 marked this pull request as ready for review April 27, 2026 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30~100 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs(FR-2645): re-capture all docs screenshots in ko/ja/th UI locales using switchLanguage

1 participant