Closed pnkraemer closed 2 years ago
The following script:
from tueplots import bundles
import matplotlib.pyplot as plt
import numpy as np
def plot(string):
plt.subplots()
plt.plot(np.arange(4), np.arange(4))
plt.xlabel("xlabel")
plt.ylabel("ylabel")
plt.title("abc $math$")
plt.savefig(string)
# Type 1 fonts
plt.rcParams.update(bundles.icml2022(usetex=True))
plot(string="usetex_True.pdf")
# Type 3 fonts
plt.rcParams.update(bundles.icml2022(usetex=False))
plot(string="usetex_False.pdf")
# TrueType fonts
plt.rcParams.update({"pdf.fonttype": 42})
plt.rcParams.update(bundles.icml2022(usetex=False))
plot(string="usetex_False_type42.pdf")
yields for pdffonts usetex_False.pdf
name type encoding emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
BMQQDV+DejaVuSans Type 3 Custom yes yes no 15 0
FTXWZA+STIXGeneral-Italic Type 3 Custom yes yes no 33 0
for pdffonts usetex_False_type42.pdf
:
name type encoding emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
BMQQDV+DejaVuSans CID TrueType Identity-H yes yes yes 15 0
FTXWZA+STIXGeneral-Italic CID TrueType Identity-H yes yes yes 23 0
and for pdffonts usetex_True.pdf
name type encoding emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
NimbusSanL-Regu Type 1 Custom yes no no 14 0
NimbusSanL-ReguItal Type 1 Custom yes no no 18 0
So if type 1 fonts are absolutely required, usetex=True
seems to be the easiest solution.
If it is only about avoiding type 3 fonts, setting pdf.fonttype
to 42 works well.
Often, conference and journal style files require Type-1 fonts. Per default, matplotlib uses type 3 fonts.
One thing that one could do would be to change the rcparams to pdf.fonttype=42,
which generates type 42 fonts. It is not clear entirely whether this is sufficient for the type 1 rule. That would require checking, though.