LoginSignup
1
1

More than 1 year has passed since last update.

EC-CUBE4 フォントの追加方法

Last updated at Posted at 2022-05-20

フォントの追加方法

EC-CUBE4系はPDFの出力にTCPDFを利用している。
TCPDFのフォント追加ツールを利用し、フォントファイルを変換し追加する。

vendor/tecnickcom/tcpdf/tools/tcpdf_addfont.php -i 追加するフォントファイル(ttf形式)

Process successfully completed!と表示されれば成功。

下記は、HG行書体を追加する場合

vendor/tecnickcom/tcpdf/tools/tcpdf_addfont.php -i HGGyoshotai.ttf

>>> Converting fonts for TCPDF:
*** Output dir set to /vendor/tecnickcom/tcpdf/fonts/
+++ OK   : HGGyoshotai.ttf added as hggyoshotai
>>> Process successfully completed!

vendor/tecnickcom/tcpdf/fontsに3つのファイルが追加される。

  • hggyoshotai.ctg.z
  • hggyoshotai.php
  • hggyoshotai.z

フォントの設定

追加したフォントを設定する。
下記は、納品書のフォントを上記処理で追加したHG行書体に変更する例

src/Eccube/Service/OrderPdfService.php
- $this->SetFont(self::FONT_SJIS);
+ $this->SetFont('hggyoshotai');

デフォルト
スクリーンショット 2022-05-20 21.43.44.png

変更後
スクリーンショット 2022-05-20 21.45.16.png

参考文献

TCPDFにフォントを追加する方法

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1