Font not embedded when exporting to EPS

46 visualizaciones (últimos 30 días)
Daan Van Cauteren
Daan Van Cauteren el 8 de Feb. de 2021
Respondida: Kiran Felix Robert el 11 de Feb. de 2021
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.

Respuestas (1)

Kiran Felix Robert
Kiran Felix Robert el 11 de Feb. de 2021
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

Categorías

Más información sobre Printing and Saving en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by