I use export_fig
(link) to export my figures to PDF. Ghostscript is needed for this: I have v9.15 installed. All my PDFs result in having the Courier font for any text, e.g. axes labels, titles and legends. This happens regardless of any font I specify for the labels.
A similar question exists (link) with an answer (link) that is based on a MATLAB documentation page that has changed since then. The answer lists a few fonts that should be compatible with the painters renderer, which is used when producing PDF files. Among them: Helvetica, which is the default font for text in MATLAB figures, so I would expect the exporting would not change the font at all. However, the font changes to Courier, no matter what font I use from the supposedly compatible fonts list.
An example that produces a PDF with Courier for me (you need export_fig
in your path and Ghostscript installed on your system).
figure
plot(peaks)
title title
xlabel xlabel
ylabel ylabel
legend legend
export_fig test.pdf
Does this produce a PDF with Courier for you too? What could be causing this behaviour on my machine?