Skip to content

fix(web): render Korean text with a Hangul webfont - #3294

Open
Sung-Heon wants to merge 3 commits into
HKUDS:devfrom
Sung-Heon:fix/korean-hangul-font
Open

Sung-Heon wants to merge 3 commits into
HKUDS:devfrom
Sung-Heon:fix/korean-hangul-font

Conversation

@Sung-Heon

Copy link
Copy Markdown

Description

Korean text in the web UI can render in a Chinese font.

Geist and Lora cover Latin only. The Korean system faces in the :lang(ko) stacks (Nanum, Malgun Gothic, Apple SD Gothic Neo) are often missing, especially on Linux and on Windows without Korean language packs. When they are missing, Hangul falls through to a Chinese face. Korean comments inside code blocks hit the same problem through the monospace stacks.

This PR ships a Hangul-only webfont and puts it right after the Latin webfont in each stack.

  • web/app/fonts/hangul-sans-variable.woff2: a Hangul-only subset of Pretendard Variable 1.3.9 (SIL OFL 1.1). "Pretendard" is a Reserved Font Name under the OFL, so the subset is renamed to "Hangul Sans". The license is in web/app/fonts/OFL.txt.
  • web/app/layout.tsx loads it with next/font/local as --font-hangul. It has unicode-range set to the Hangul blocks and preload: false, so a page with no Korean text never downloads it.
  • --font-hangul follows --font-sans / --font-serif in the Tailwind sans and serif stacks, the :lang(ko) stacks in globals.css, and the notes, favorites and SVG stacks. Latin stays Geist or Lora, and Hanzi and kana still resolve to the faces after it. That keeps the ordering rule from fix(web): language-aware CJK font stacks for chat prose #2541 intact.
  • Code: a Tailwind mono stack and the inline MONOSPACE stack in RichCodeBlock.tsx add --font-hangul before the generic monospace.

Related Issues

Module(s) Affected

  • web (Frontend)
  • tests

Checklist

  • This PR targets dev (not main — see the base-branch selector above).
  • I have read and followed the contribution guidelines.
  • My code follows the project's coding standards.
  • I have run pre-commit run --all-files and fixed any issues. (Run on this branch's changed files; it fixed trailing whitespace in the license file.)
  • I have added relevant tests for my changes.
  • I have updated the documentation (if necessary). (No docs mention font stacks.)
  • My changes do not introduce any new security vulnerabilities.

Additional Notes

Evidence, all on this branch rebased onto dev:

  • npm run test:node: 1441 tests, 1441 pass. content-lang-cjk-fonts.test.ts now also checks that --font-hangul comes before the Korean system faces in .prose:lang(ko) and .font-sans:lang(ko).
  • npm run typecheck passes. eslint on the changed TS/JS files passes.
  • I checked the font file with fontTools. It has 11,225 codepoints, all Hangul: the full set of 11,172 modern syllables, plus jamo. It has no Latin, Hanzi or kana. The family name is "Hangul Sans", and the wght axis is 45–930, which matches weight: "45 930" in layout.tsx.

Cost: the file is 1.7 MB. The browser fetches it only on pages with Hangul on screen, because of unicode-range, and it is not preloaded.

No screenshot yet. I tested on macOS, where Apple SD Gothic Neo is present, so the broken fallback does not reproduce there. I can add before/after screenshots from a Linux or Windows machine without Korean fonts if that helps the review.

AI-assisted. I have read and understand the change.

🤖 Generated with Claude Code

cursoragent and others added 3 commits December 6, 2026 08:44
Geist and Lora are Latin-only, and the Korean system faces in the
:lang(ko) stack are often missing, so Hangul fell through to a Chinese
face. Ship a Hangul-only Pretendard subset after the Latin webfonts.

Co-authored-by: Sungheon Jeong <elon4856@gmail.com>
Answer prose already fell back to Hangul Sans, but fenced code sets an inline monospace stack and inline code uses font-mono. Neither included the Hangul subset, so Korean comments rendered with a Chinese fallback.

Co-authored-by: Sungheon Jeong <elon4856@gmail.com>
@github-actions github-actions Bot added bug Something isn't working web Web frontend (Next.js UI & components) labels Dec 5, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working web Web frontend (Next.js UI & components)

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants