Internationalization
The headless browser has access to whatever fonts the host OS / container provides. The Docker image bundles Noto Sans CJK, which covers Japanese, Chinese, and Korean without tofu.
Japanese labels
Why it works
- In Docker: the
Dockerfileinstallsfonts-noto-cjk. Chromium picks it up automatically as the fallback for CJK glyphs. - On your host (without Docker): whatever your OS uses. On macOS and recent Windows, CJK just works. On fresh Linux minimal installs, you may need to
apt install fonts-noto-cjkor similar.
Verifying a non-default locale
Quickest smoke test:
# JA
echo '{"type":"bar","data":{"labels":["東京"],"datasets":[{"data":[1]}]}}' \
| chartjs2img render -o /tmp/ja.png
# ZH
echo '{"type":"bar","data":{"labels":["北京","上海"],"datasets":[{"data":[1,2]}]}}' \
| chartjs2img render -o /tmp/zh.png
# KO
echo '{"type":"bar","data":{"labels":["서울","부산"],"datasets":[{"data":[1,2]}]}}' \
| chartjs2img render -o /tmp/ko.pngIf any of those render as boxes, check font install on the host (or use the Docker image).
Right-to-left scripts
RTL (Arabic, Hebrew) also render correctly — Chart.js + Chromium handle the text layout natively. Punctuation and bidi isolates behave as expected. We don't ship an RTL-specific font pack; the glyph coverage of Noto Sans gets you there on most systems.
Forcing a specific font
Chart.js options.font.family cascades down to every text element. Whatever you set needs to be installed on the server. chartjs2img doesn't preload custom fonts — you own that layer if the default stack doesn't cover your content.
