Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Improve font configuration in the docker image #310

Merged
merged 1 commit into from
Jul 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,34 @@ RUN set -x \
&& mkdir /ms-playwright \
&& npx playwright@${PLAYWRIGHT_VERSION} install --with-deps chromium \
&& chmod -R 777 /ms-playwright \
# remove poor quality fonts
&& apt-get purge -y ttf-unifont fonts-ipafont-gothic fonts-wqy-zenhei \
# install Microsoft TrueType core fonts
&& echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections \
&& apt-get install -y --no-install-recommends ttf-mscorefonts-installer \
# install all Noto fonts
&& apt-get install -y fonts-noto \
# font aliases for Noto CJK fonts
&& echo '<?xml version="1.0"?>\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

font alias Win/Mac mincho and gothic font names to Noto CJK fonts ("Yu Mincho" → "Noto Serif CJK JP", "Hiragino Sans" → "Noto Sans CJK JP", etc)

@MurakamiShinyu この対応を入れない場合でも問題なく動作すると思うのですが、Aliasを設定するのにはなにか理由はありますか?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spring-raining #303 (comment) (font-family: serif を指定しても明朝体にならない問題と対策)で説明しました。ご覧ください。

<!DOCTYPE fontconfig SYSTEM "fonts.dtd">\
<fontconfig>\
<alias><family>Source Han Serif</family><prefer><family>Noto Serif CJK JP</family></prefer></alias>\
<alias><family>Hiragino Mincho ProN</family><prefer><family>Noto Serif CJK JP</family></prefer></alias>\
<alias><family>Hiragino Mincho Pro</family><prefer><family>Noto Serif CJK JP</family></prefer></alias>\
<alias><family>YuMincho</family><prefer><family>Noto Serif CJK JP</family></prefer></alias>\
<alias><family>Yu Mincho</family><prefer><family>Noto Serif CJK JP</family></prefer></alias>\
<alias><family>MS Mincho</family><prefer><family>Noto Serif CJK JP</family></prefer></alias>\
<alias><family>MS PMincho</family><prefer><family>Noto Serif CJK JP</family></prefer></alias>\
<alias><family>Source Han Sans</family><prefer><family>Noto Sans CJK JP</family></prefer></alias>\
<alias><family>Hiragino Sans</family><prefer><family>Noto Sans CJK JP</family></prefer></alias>\
<alias><family>Hiragino Kaku Gothic ProN</family><prefer><family>Noto Sans CJK JP</family></prefer></alias>\
<alias><family>Hiragino Kaku Gothic Pro</family><prefer><family>Noto Sans CJK JP</family></prefer></alias>\
<alias><family>YuGothic</family><prefer><family>Noto Sans CJK JP</family></prefer></alias>\
<alias><family>Yu Gothic</family><prefer><family>Noto Sans CJK JP</family></prefer></alias>\
<alias><family>Meiryo</family><prefer><family>Noto Sans CJK JP</family></prefer></alias>\
<alias><family>MS Gothic</family><prefer><family>Noto Sans CJK JP</family></prefer></alias>\
<alias><family>MS PGothic</family><prefer><family>Noto Sans CJK JP</family></prefer></alias>\
</fontconfig>' > /etc/fonts/local.conf \
&& apt-get install -y --no-install-recommends \
# dependencies for press-ready
ghostscript poppler-utils \
Expand Down