This Blog is written by Chinese. If you prefer a guide written by english, you can visit Jamie Oaks’s Blog.
最近提交论文后,收到了 ACM 的要求:将 “type 3 fonts” 变为 “type 1 fonts”。查了一下后,发现大多数论文都不能使用 “type 3 fonts”。因此记录一下这回的解决方案,免得下回四处 Google 。
我发现在 ACM 标记出使用 “type 3 fonts” 的地方都为 PDF 图片。这是因为这些图片都是通过 matplotlib 来生成的,而 matplotlib 默认字体是 “type 3 fonts” 。因此,我们需要做的就是将 matplotlib 的默认字体从 “type 3 fonts” 转为 “type 1 fonts”。实现转换有很多方法,可以根据需求选择。
想要检查是否 PDF 中包含 “type 3 fonts” 可以使用
1 | pdffonts MY_PDF.pdf |
MacOS 上可以通过安装 poppler 来安装 pdffonts 。
1 | brew install poppler |
Option 1
我们可以通过修改 matplotlibrc 来改变所有 matplotlib 生成的 pdf 中的字体为 “type 3 fonts”。
首先我们通过 find 找到 matplotlibrc 的位置,然后将其中的 pdf.fonttype 和 ps.fonttype 的值改为 42。 这样 matplotlib 生成的 PDF 中默认字体就为 “type 3 fonts”了。
1 | # 查找 matplotlibrc 位置 |
1 | pdf.fonttype : 42 |
Option 2
我们也可以在代码中加入以下代码,这样可以临时将 pdf.fonttype 和 ps.fonttype 变为 42。
1 | import matplotlib |