Font not embedded when exporting to EPS
Ältere Kommentare anzeigen
When generating figures I have chosen a font (e.g. CMU Serif) for all the text. When the figure is created, it shows the font perfectly. When I export it as .pdf or .eps (either by print(), saveas(), exportgraphics(),...) it does not embed my chosen font, but overwrites it by changing it to 'Courier'. As I want vector files of the figures, and want to save/print the figures in the code, is there a way to correctly include the chosen font, as previewed in the figure, in the .eps/.pdf file. As per previous threads, I noticed that this was an issue for older versions of Matlab, more specifically that the list of available embeddable fonts was just limited to a select few. Is this still a problem? Can I manually add fonts to the list? Are there any workarounds that do not include the need of manual work, but merely rely on the use of Matlab code?
Kind regards, Daan.
Antworten (1)
Kiran Felix Robert
am 11 Feb. 2021
Hi Daan,
Current PostScript implementation supports only the fonts listed below,
- Courier
- Helvetica
- ZapfDingbats
- Times
- Times-Roman
To support other fonts there are several possible workarounds,
- Print the figure to an SVG file, and then convert it to EPS with Inkscape (https://inkscape.org/en/)
- Print the figure to a PDF, use ghostscript to embed the fonts, and then convert to EPS. Here is the ghostscript command to run on the command prompt:
gs -dSAFER -dNOPLATFONTS -dNOPAUSE -dBATCH -sDEVICE=pdfwrite
-sPAPERSIZE=letter -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer
-dCompatibilityLevel=1.4 -dMaxSubsetPct=100 -dSubsetFonts=true
-dEmbedAllFonts=true -sOutputFile=embed.pdf -f unembed.pdf
In the above command, change only the filenames in red.
You can then convert the PDF to EPS using "pdftops" (a UNIX command) or "pdf2ps" (in ghostscript library).
- There are also several File Exchange submissions that might address the issue: https://www.mathworks.com/matlabcentral/fileexchange/35429-eps-utility-toolboxhttps://www.mathworks.com/matlabcentral/fileexchange/7501-printeps
If you have any issues with the File Exchange submissions, feel free to reach out to the authors.
1 Kommentar
Riccardo
am 10 Feb. 2026 um 9:38
I really appreciated your detailled comment. Now I am simply wondering if there is any news regarding compatibility with other fonts in the latest MATLAB versions ;-)
Kategorien
Mehr zu Printing and Saving finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!