msttcorefonts
CentOS 7 で wkthmltopdf 0.12.4 を使用して docker コンテナーを実行しようとしています。「Arial」、「Times New Roman」、および「Courier New」のみをサポートし、パッケージを処理したいと考えています。したがって、解放フォント パッケージは十分に近いものです。ただし、正しく一致させるには、追加の構成を追加する必要があるようです。
コンテナ内では、フォントが予想どおりに一致しているようです
[root@bafe67a1d200 /]# fc-match 'Arial'
LiberationSans-Regular.ttf: "Liberation Sans" "Regular"
[root@bafe67a1d200 /]# fc-match 'Times'
LiberationSerif-Regular.ttf: "Liberation Serif" "Regular"
[root@bafe67a1d200 /]# fc-match 'Courier New'
LiberationMono-Regular.ttf: "Liberation Mono" "Regular"
しかし、wkhtmltopdfを使用してckEditorから次のものを変換しようとしたとき
<span style="font-family:'arial' , 'helvetica' , sans-serif">
This is Arial
</span>
<span style="font-family:Times New Roman,Times,serif;">
This is Times
</span>
<span style="font-family:Courier New,Courier,monospace;">
This is Courier New
</span>
それらはすべて、pdf で LiberationSans として戻ってきます。
ただし、手動でフォント ファミリを次のように変更する場合。期待どおりに動作します
<span style="font-family:'Liberation Sans'">This is Arial</span>
<span style="font-family:'Liberation Serif">This is Times</span>
<span style="font-family:'Liberation Mono">This is Courier New</span>
そのため、動作に合わせて fontconfig に構成を追加する必要があるかもしれないと思います
Here is my docker file
FROM dockerhub.com/jetty
# must be root to install things
USER root
# install wkhtmlpdf and its dependencies
RUN yum install -y libXrender fontconfig libXext && \
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz -O wkhtmltopdf.tar.xz && \
tar -Jxf wkhtmltopdf.tar.xz && \
cp -r wkhtmltox/bin/* /usr/local/bin/ && cp -r wkhtmltox/lib/* /usr/lib/ && cp -r wkhtmltox/include/* /usr/include/ && \
rm wkhtmltopdf.tar.xz && \
# install supported fonts
# - liberation-sans-fonts: Airal
# - liberation-serif-fonts: Times New Roman
# - liberation-mono-fonts: Courier New
yum install -y liberation-fonts-common liberation-serif-fonts liberation-sans-fonts liberation-mono-fonts
# copy the war into jetty to be deployed
COPY maven /opt/jetty-base