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 #304

Closed
wants to merge 1 commit into from

Conversation

MurakamiShinyu
Copy link
Member

@MurakamiShinyu MurakamiShinyu commented Jun 28, 2022

  • add Microsoft TrueType Core Fonts
  • add IPAMincho/IPAPMincho (in addition to IPAGothic/IPAPGothic)
  • add IPAexMincho and IPAexGothic
  • alias Win/Mac mincho and gothic font names to IPA fonts

resolves #303


Update: This PR was cancelled and replaced with

- add Microsoft TrueType Core Fonts
- add IPAMincho/IPAPMincho (in addition to IPAGothic/IPAPGothic)
- add IPAexMincho and IPAexGothic
- alias Win/Mac mincho and gothic font names to IPA fonts

resolves #303
@MurakamiShinyu
Copy link
Member Author

MurakamiShinyu commented Jun 29, 2022

日本語の明朝体・ゴシック体のフォントとして IPAex フォントを使うか、Noto CJK フォントを使うか比較検討した。そのうえで今回は IPAex を使うことにした。理由は Noto CJK フォントではルビの表示の不具合が目立つことなど。次のコメント参照:

この IPAex フォント (fonts-ipaexfont) を組み込むようにした Dockerfile 更新のコミット: 307c652

比較テストのために、Noto CJK フォントを含むすべての Noto フォント (fonts-noto) を組み込むようにした Dockerfile 更新のコミット: 37fc872

またすべての Noto フォントではなく最低限の Noto CJK フォント (fonts-noto-cjk) を組み込むようにした Dockerfile 更新のコミット: 9a38ff2

各 Docker イメージのサイズの比較は以下:

$ docker images
REPOSITORY                       TAG             IMAGE ID       CREATED         SIZE
vivliostyle-cli-fonts-ipaex      latest          fd0d75fa1acd   10 hours ago    2.21GB
vivliostyle-cli-fonts-notocjk    latest          db980e8a50c7   10 hours ago    2.27GB
vivliostyle-cli-fonts-noto       latest          d342944bea45   11 hours ago    2.92GB
ghcr.io/vivliostyle/cli          5.1.0           abcc81e4ef96   2 weeks ago     2.12GB

Noto フォントをすべて入れると Docker イメージのサイズがだいぶ大きくなる。しかし最低限の Noto CJK フォント(ウェイトが Regular と Bold のみ)では Noto CJK フォントのメリットが半減。

以上、将来(Chromium 108 以降の見込み。vivliostyle/vivliostyle.js#896 (comment) 参照)Chromium のPDF出力のレイアウトエンジンが更新されてルビの表示の不具合が解消したときに再検討するためのメモとして。

@MurakamiShinyu
Copy link
Member Author

I wrote:

…今回は IPAex を使うことにした。理由は Noto CJK フォントではルビの表示の不具合が目立つことなど。

以上、将来(Chromium 108 以降の見込み。vivliostyle/vivliostyle.js#896 (comment) 参照)Chromium のPDF出力のレイアウトエンジンが更新されてルビの表示の不具合が解消したときに再検討するためのメモとして。

と書いたが、ルビの表示の不具合については vivliostyle/vivliostyle.js#896 (comment) にある --enable-blink-features=LayoutNGPrinting を使うことで、いまの Chromium でもこの問題を解決できるかもしれない。そうなると Noto CJK フォントのほうがよさそう。

再検討のため、ドラフトPRとしておきます。

@MurakamiShinyu
Copy link
Member Author

すべてのNotoフォントを入れるとDockerイメージサイズがかなり大きくなるということについては、もとのPlaywrightのDockerイメージを小さくすることであまり問題ではなくなりそう:

@MurakamiShinyu MurakamiShinyu deleted the docker-fonts-ipaex branch July 3, 2022 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve font configuration in the docker image
1 participant