Chinese, Japanese, and Korean text

Configure interface translations, browser fonts, and PDF fonts for Chinese, Japanese, and Korean documents.

Chinese, Japanese, and Korean (CJK) text needs three separate settings: i18n translates the controls, locale sets regional behavior, and document fonts draw the text.

Configure CJK fonts

Add one CJK font source after your other resolvers. Pass the list to useFonts() or the fonts option of useDocxSource().

import { packagedFonts } from '@docx-editor.dev/fonts';
import { googleFonts } from '@docx-editor.dev/fonts/google';

const fontResolvers = [packagedFonts(), googleFonts({ cjk: true })];

Use one CJK source. If you list both, both fonts download and the first one paints the text. For resolver mechanics, see Fonts and measurement.

Choose a font source

SourceRequestsFacesSize
googleFonts({ cjk: true })Third party, pinned revision with hash checkOne Noto Sans face per region: Japanese, Simplified Chinese, Traditional Chinese, or Korean4.6 to 8.5 MB each
cjkFonts() from @docx-editor.dev/fonts-cjk/browserYour origin onlyOne Japanese regular face for every supported familyAbout 16 MB
  • Both load in the background by default. The document lays out again when the faces arrive.
  • To load with the document's other fonts, pass { loading: 'wait' }: googleFonts({ cjk: { loading: 'wait' } }) or cjkFonts({ loading: 'wait' }).
  • Both fetch only when the document requests a supported family. Both use one regular face for bold and italic.

Packaged browser fallback

Install @docx-editor.dev/fonts-cjk to keep every font download on your own origin.

import { packagedFonts } from '@docx-editor.dev/fonts';
import { cjkFonts } from '@docx-editor.dev/fonts-cjk/browser';

const fontResolvers = [packagedFonts(), cjkFonts()];

Your bundler emits the font asset.

Interface language

The ja and zhCN catalogs translate the editor controls. No Korean catalog is bundled; supply a custom one or use another interface language.

import { DocxEditor } from '@docx-editor.dev/react';
import { ja } from '@docx-editor.dev/i18n';

<DocxEditor document={bytes} i18n={ja} locale="ja-JP" />;

For Simplified Chinese, use zhCN with locale="zh-CN". In composed editors, pass translations to LocaleProvider. For catalog setup, see Interface translations.

Configure PDF fonts

Browser font configuration does not configure the PDF server. Install @docx-editor.dev/fonts-cjk on the server or supply server fonts. For setup, see Add Chinese, Japanese, and Korean text to PDF export.

Limits

  • The font picker treats a font as East Asian when its name is a known CJK font, uses CJK characters, or contains CJK, JP, or KR. A custom CJK font with another Latin name counts as Latin.
  • A listed font family does not prove that its files loaded. Check the font notice.
  • Bold, italic, and other weights need their own font files.
  • Custom key handlers must not intercept input method composition keystrokes.
  • A character that a serif Korean font lacks draws in a serif Hangul font: Batang, AppleMyungjo on macOS, or Noto Serif CJK KR. The font table marks a serif Korean font with w:family="roman" and a Korean w:charset.
  • With word wrapping, a Korean word moves to the next line as one unit, with its ASCII punctuation, digits, and Latin letters.
  • Typography rules and vertical-text limits are in DOCX feature support.

See also