Font problems when exporting as EPS

I just upgraded to R2014b. When exporting figures via "print -depsc" the resulting EPS files have weird fonts embedded that are unreadable by Adobe Illustrator. Is there anything I can do to fix this? I want to go back to exporting with helvetic or arial font.

8 Commenti

Does it tell you the names of the "weird fonts"? Maybe they are TeX or LaTeX fonts? If so you can copy the appropriate fonts from your matlab folder to your illustrator folder.
See detailed comment below. Illustrator says it cannot find the fonts "any:" or "any-Bold". It exported just fine as Helvetica in R2014a and earlier.
I'm having a similar issue on OS X 10.9.4 when I open a figure (that uses latex) in Preview.app. I get the error:
PostScript Conversion Warning:
Converting the PostScript file "test.eps" produced the following warnings:
· CMR10 not found, using Courier.
· CMMI10 not found, using Courier.
I am having a similar issue with R2014b under Unbunto14.04 with Greek letters in title and export to .eps, .ps or .pdf (all of which by default use painters renderer rather opengl which is used for screen image). Just try
figure(1);
%plot(x, y) % Actual plot irrelevant, pick any x, y or omit
title('Plot 1, default settings: sin(4 \pi x)');
print -depsc fonterr1
The file fonterr1.eps refers to a font /any rather than something like /mwb_cmmi10, so the \pi is not displayed correctly (and the spacing is ugly). Removing bold in title (default Helvetica bold) or adding some Greek text in plot both produce correct symbol, but ugly spacing. Using LaTeX as interpreter works, as does using opengl as renderer (but then you get bitmap rather than vector format).
Seems to be a bug with painters renderer and certain symbols? Happy to proved more detailed test script.
Luigi Feriani
Luigi Feriani il 12 Gen 2015
Modificato: Luigi Feriani il 12 Gen 2015
Hi, I got the same bug today when I first installed 2014b (Win7 x64).
For me 2 things worked:
1. saving to svg instead (although I realise it isn't really a solution) using
print(gcf,'pippo.svg','-dsvg')
2. creating a dummy axes with a single, non-bold, greek letter, and putting it on the bottom of the figure with the same color of the figure background
% plot
plot(1,1);
xlabel('sin\pi','FontWeight','b');
ylabel('sin\pi','FontWeight','b');
%dummy axes now
dummy = axes;
dummy.XColor = get(gcf,'Color');
dummy.YColor = get(gcf,'Color');;
xlabel(dummy,'\pi');
uistack(dummy,'bottom');
after doing this I could both successfully save as an .eps and use export_fig, although it looks like only the latin letters are bold
Ian Harris
Ian Harris il 26 Gen 2015
Modificato: Walter Roberson il 13 Nov 2015
I upgraded to 2014b last week (OSX 10.10.1, 'Yosemite').
I produce .eps files with Matlab, then convert to .pdf using the Preview app.
Now I get the font error when Preview tries to convert to .pdf:
'Helvetica-Italic not found, using Courier'
Of course, the font should be called 'Helvetica-Oblique' - this is the font listing in the .eps files:
%FOPBeginFontDict
%%IncludeResource: font Courier-Bold
%%IncludeResource: font Helvetica
%%IncludeResource: font Courier-BoldOblique
%%IncludeResource: font Courier-Oblique
%%IncludeResource: font Times-Roman
%%IncludeResource: font Helvetica-BoldOblique
%%IncludeResource: font Helvetica-Bold
%%IncludeResource: font Helvetica-Oblique
%%IncludeResource: font Times-BoldItalic
%%IncludeResource: font Courier
%%IncludeResource: font Times-Italic
%%IncludeResource: font Times-Bold
%%IncludeResource: font Symbol
%%IncludeResource: font ZapfDingbats
%FOPEndFontDict
Yet, later on, other font names appear, eg:
/Helvetica-Italic 4 F
I assume this is what's causing the problem?
PLEASE get it fixed. This breaks Preview so I can't use it to join multiple plots into a .pdf any more! I need to do this regularly..
EDIT: I tried a global find & replace to change 'Helvetica-Italic' into 'Helvetica-Oblique' - that worked perfectly. So it seems to be a case of the .eps generator not paying attention to the included font names that it knows about.
Jeff
Jeff il 16 Mar 2015
Update: I just downloaded R2015a. It still does not encode fonts correctly into EPS files. Disappointing that this bug was not fixed for the new release.
I had the same problem, fonts aren't exported correctly to EPS in Matlab 2015b. The use of TickLabelInterpreter solved the problem
set(a,'TickLabelInterpreter', 'latex')

Accedi per commentare.

Risposte (12)

JanikKk
JanikKk il 14 Lug 2016

3 voti

Workaround
I have the same issue with Matlab R2015a. When I try to open the exported .eps file (a simple x-y plot) in Illustrator (CS6) I get an error message, which says that a couple fonts are missing: mwa_cmmi10, mwb_cmmi10, etc and Illustrator will replace them. I used the Latex interpreter in the axes labels, "cmmi" indicates that Matlab used the computer modern font family, which is the typical Latex font family. The only problem is that Matlab, for some reason, added the "mwa_" or "mwb_" in front of the actual font names, which are embedded in the file. These font names do not exist in the system (I'm using Mac) and therefore Illustrator cannot access them.
What worked for me:
  1. Make your plots in Matlab, save them as .eps with whichever font you want
  2. Download the font family you used or check if it's already installed on your system (common fonts like Helvetica (on Mac), Times, etc are usually already installed. The Latex fonts//the computer modern family can be found on the internet)
  3. Open the eps.-file with Illustrator and click "ok" when the error message about the missing font pops up
  4. Now go to "Fonts --> Find Font..."
  5. The "Find font" dialogue shows which fonts are in your document. Missing fonts are displayed with an asterisk*.
  6. Replace these fonts with the corresponding font availabe in your system. For me it was "mwa_cmmi10" --> "cmmi10" in regular and "mwb_cmmi10" --> "cmmi10" in bold.
(This did not solve all of my font problems but at least 90%. Still having problems with some math symbols) Check: https://helpx.adobe.com/illustrator/using/find-missing-fonts.html
Erik Johnson
Erik Johnson il 4 Mag 2016
Modificato: Erik Johnson il 4 Mag 2016
This is still a problem in 2016a. Inexcusable that this has not been fixed in 2 years of releases.
plot([0 1],[0 1]);
xlabel('This is {\it{italic}}.')
ylabel('This is {\sl{slanted}}.')
print -depsc2 test.eps
"italic" and "slanted" are both set in the EPS file to be "Helvetica-Italic", which, of course, does not exist. The correct font is "Helvetica-Oblique" -- and has been for decades! This worked fine prior to HG2.

1 Commento

You'll need to wait until Matlab 2035b is released. By that time they will fix all the bugs from the 2014b release. But by that time everyone will realize that there are alternatives (e.g. R) that can print eps files without any problems, and don't cost thousands of dollars.

Accedi per commentare.

matt dash
matt dash il 13 Ott 2014

1 voto

This certainly looks like a bug in the eps export. I don't have 2014b yet, but when i run your code in 2014a Illustrator tells me the missing fonts are "Helvetica" and "Helvetica-Bold"... looks like somehow the new version is replacing the word Helvetica with "any". You can try editing the .eps file in a text editor and find/replacing "any" with "Helvetica"... who knows, it might work.

1 Commento

Jeff
Jeff il 14 Ott 2014
I never knew that and EPS file could be edited in a text editor. I always assumed it was a binary format. Replacing "any" with "Helvetica" fixed the main text problem. The symbol did not come through, still, and I also am stuck with gray axes, which I am sure I can figure out how to fix. That said, I'm not going to run a batch replace on every figure I make. The exporter in R2014b needs to be fixed. I should note that this happens when doing a PDF export as well, so it is a more general exported problem.

Accedi per commentare.

Ema
Ema il 15 Gen 2019

1 voto

Hi All,
I have the same problem. I do not have Helvetica. Therefore I did a different test.
I saved the figure using Arial font. Result: AI still misses Helvetica... I found this weird.
Then I did a trick: I converted my matlab eps into pdf. In pdf it result correct (Arial font).
When imported in AI the pdf is also correct and recognize the arial font, without asking for Helvetica.
I am wondering if it is practical to save directly editable pdfs from matlab or alternatively convert the eps in pdf.
My suspect is that the problem is not matlab, rather AI.
What you think?
I am using Matlab R2018b
Jeff
Jeff il 9 Ott 2014

0 voti

I wanted to provide an update with more details of my problem. In Matlab R2014a and earlier, the figure I want to make looks like:
I plotted this using standard plot commands and exported as an EPS file using the "print -depsc filename.eps" command. I have done this for over a decade in many versions of Matlab. It always works the same. The uploaded figure is generated after opening in Adobe Illustrator CS6 and exporting as a PNG since EPS files can't be displayed online easily.
Now, if I run the exact same script in the new release, Matlab R2014b, the figure looks the same in Matlab, but the exported EPS file looks like:
Most critically, the fonts no longer pass through. I had Helvetica plus a symbol font before. Now, despite the fonts showing up fine in Matlab, the fonts in the EPS figure are all screwed up. Illustrator gives an error when opening the file that says it cannot find the fonts "any:" and "any-Bold:". This has to be something to do with the new graphics component of Matlab R2014b, but I don't know what code to use to get around this since the code that has worked for a decade no longer works. I'm not doing anything weird.
I should also not that the print command takes a lot longer to run. Bracketing the command with tic and toc gives 0.25 seconds in R2014a but 3.08 second in R2014b. Something is really messed up with R2014b but I am hoping there is some sort of work around. For now I will keep using Ro2014a but welcome any suggestions.

4 Commenti

Can you try using tex as the interpreter? Does that change anything?
xlabel(['k (' char(197) '^-^1)'],'FontSize',14,'FontName','Helvetica','FontWeight','bold','Interpreter','tex')
ylabel(['\chi(k)' char(197) '·k^3 (' char(197) '^-^3)'],'FontSize',14,'FontName','Helvetica','FontWeight','bold','Interpreter','tex')
What if you don't use bold fonts but just regular fonts?
Jeff
Jeff il 13 Ott 2014
Had never thought of the 'Interpreter' command. Unfortunately, still have the same problem in R2014b. Fine in all earlier versions. Getting rid of bold also does not fix things.
I am having the same issue, where symbols in my axis labels show up fine in the Matlab figure but do not export correctly when I save the file as either .eps (and insert into a LaTeX document) or as a .pdf. I hope this issue is resolved soon. It's annoying to have to open the figures in an older version of Matlab just to save as .eps.

Accedi per commentare.

Doug Hull
Doug Hull il 13 Ott 2014
Modificato: Doug Hull il 13 Ott 2014
From the printing developer:
The issue is that Illustrator complains about a missing Helvetica font when the file is imported. This is true in HG1 as well. We don't embed the font in our generated output file and if the font isn't installed locally on the system Illustrator won't find it.
It's funny in a way, given that Helvetica is one of the standard Adobe Postscript fonts and Adobe Illustrator doesn't provide support for it
Make sure AI has access to the font.
Can you send reproduction steps directly to hull @ mathworks.com

7 Commenti

I installed Helvetica fonts on my computer and Illustrator can access them. I actually have a support request in and the initial support person confirmed my problems in R2014b and said that he sent this to "the developers". Will report back when I get an answer.
I did send them a simpler example code that has the same problem but doesn't require reading in a whole set of data files, as in my problem figure above. The code is attached below. Note that I have had no problems plotting and exporting this way since at least 2002. It only cropped up with the new graphic component built into R2014b.
figure(1)
hold off
plot([2 3],[2 3],'r-','LineWidth',2)
hold on
plot([2:0.1:3],[1.95:0.1:2.95],'ko','LineWidth',2)
set(gca,'FontSize',12,'FontName','Helvetica','LineWidth',1.5)
xlabel('k (Å^-^1)','FontSize',14,'FontName','Helvetica','FontWeight','bold')
ylabel('\chi(k)·k^3 (Å^-^3)','FontSize',14,'FontName','Helvetica','FontWeight','bold')
set(gcf,'Units','inches','Position',[0.5,3.5,6,5]);
set(gcf,'PaperPositionMode','auto')
% tic
print -depsc test.eps
% toc
You never said explicitly here: Did installing Helvetica help?
Jeff
Jeff il 15 Feb 2015
Helvetica was installed for about 4 years before this happened. Long before installation of R2014B or even R2012A!
(Answers dev) unaccepted answer due to OP's request.
Jeff
Jeff il 11 Lug 2017
So will this basic problem ever be fixed in a future release of Matlab? I don't understand how you can break something like EPS file export and then not fix it for years!
Jeff, what was Mathwork's response when you opened a technical support case on this matter?
I don't remember, their exact response, but it was always very dragged out, and I have a job and can't spend hours dealing with them. The problem is well documented here and has not been fixed. They should address it. I'm pretty fed up.

Accedi per commentare.

yserra
yserra il 10 Feb 2015

0 voti

Has this issue been addressed anywhere? I am having the same issue with 2014b installed on a mac running Yosemite OS. Times New Roman font is written to eps file as Times Roman and no other application (Illustrator or Preview) can open with correct font. Like the other users here, I've used Matlab for years and made eps files with no issue (at least not like this). This seems inexcusable that they would release this product with such a basic error.

3 Commenti

Jeff
Jeff il 15 Feb 2015
I never got anywhere with this and gave up. Cannot get this to work in R2014B. Total mess. I hate the new graphics code. They should have at least made sure that simply plotting code used by people for a decade still worked.
It's a travesty that the Mathworks can't address issues like this given how much they charge for this piece of software. Nearly impossible to produce publication-quality figures anymore. That's why I'm defecting to Python.
Stewart, what was Mathwork's response when you opened a technical support case on this matter?

Accedi per commentare.

Brian
Brian il 20 Feb 2015

0 voti

I have this problem as well. One can maybe work around it by copying the symbol itself into the text command, rather than the latex escape. e.g., I had this problem with \omega, but when I used ω directly instead the problem was resolved. So the issue seems to be a latex->eps problem in matlab. (Truely annoying, however, yes.)
Razvan
Razvan il 29 Gen 2016

0 voti

I wonder if Mathworks is ever going to fix this bug... It is present since R2014b... it is easily reproducible (every exported eps has some messed up fonts)... and I'm pretty sure R2016a will continue to have the bug. Come on Mathworks! Fix the damn bug!
Corina
Corina il 20 Lug 2016

0 voti

I have the same issue with Matlab R2014b. It also applies when using the Latex Interpreter in the Legend fields. Super annoying :(. I haven't found any workaround for it.
mwatts
mwatts il 6 Mar 2018

0 voti

same issue in 2017b

1 Commento

I'm still running 2014a. I have tried Mathworks Tech Support but they respond slowly, don't believe me, and drag this out. I have work to do, and can't follow up with them regularly, and then the just mark the problem solved.

Accedi per commentare.

lachlan greve
lachlan greve il 30 Ago 2018

0 voti

fix it

1 Commento

Jeff
Jeff il 30 Ago 2018
And Mathwork's comment system is so poorly designed that it asked me "If lachlan greve's answer resolves your question?" Obviously, this resolved nothing, and I appreciate you chiming in that all of this needs to be fixed.

Accedi per commentare.

Categorie

Prodotti

Richiesto:

il 8 Ott 2014

Risposto:

Ema
il 15 Gen 2019

Community Treasure Hunt

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

Start Hunting!

Translated by