🌷

Ubuntu Desktopで採用されてる見栄えのよいフォントをDocker環境のPuppeteerでも使う

2025/01/25に公開

Docker環境で日本語の字形が異なる

Puppeteer公式ドキュメントに載ってるフォントをDocker環境に入れると、日本語の字形が本来とは異なってしまう
Image from Gyazo

詳しい原因
https://ibemu.dev/post/2024/09/08/playwright-noto-font/

代わりにUbuntu Desktopのフォントを入れる

デスクトップPC向けのフォントリストなら、見栄えよくメンテされているはず
絵文字フォントも入る

https://old-releases.ubuntu.com/releases/24.04/ubuntu-24.04-desktop-amd64.manifest をもとに、以下のフォントを入れることにした

# Fonts list from: https://old-releases.ubuntu.com/releases/24.04/ubuntu-24.04-desktop-amd64.manifest
RUN apt-get install -y \
  fonts-arphic-ukai \
  fonts-arphic-uming \
  fonts-dejavu-core \
  fonts-droid-fallback \
  fonts-liberation \
  fonts-noto-cjk \
  fonts-noto-color-emoji \
  fonts-noto-core \
  fonts-noto-mono \
  fonts-opensymbol \
  fonts-urw-base35

日本語を読みやすくなった
Image from Gyazo
https://almap.hata6502.com/

Discussion