Font not embedded when exporting to EPS

41 次查看(过去 30 天)
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.

回答(1 个)

Kiran Felix Robert
Kiran Felix Robert 2021-2-11
Hi Daan,
Current PostScript implementation supports only the fonts listed below,
  1. Courier
  2. Helvetica
  3. ZapfDingbats
  4. Times
  5. 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).
If you have any issues with the File Exchange submissions, feel free to reach out to the authors.
You can also refer to the answers here for more information

类别

Help CenterFile Exchange 中查找有关 Printing and Saving 的更多信息

产品


版本

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by