Is it possible to get around MATLAB's limitation on font embedding in vector format files?

隐身守侯 提交于 2019-11-29 15:11:55

问题


According to the MATLAB manual, when you save a figure using print or by choosing file|save, if you choose the painters renderer and save to PDF or EPS vector formats, all fonts get substituted. Is there a way to get around this limitation?

Whenever I output a figure, whether I use print or export_fig, the fonts get substituted, and so they no longer match the fonts in the document that I plan on putting the figure into. I would prefer to keep them in a vector format, because I use LaTeX and so I want to be able to use the same figures in my documents as in my beamer presentations and have them scale nicely without bloating the file size.


回答1:


If I'm reading that link correctly, not all fonts get substituted. From 'Choosing a Printer Driver':

The table below lists the fonts supported by the MATLAB PostScript and Ghostscript drivers when generated with the Painters renderer (fully vectorized output). This same set of fonts is supported on both Windows and UNIX:

AvantGarde
Helvetica-Narrow
Times-Roman
Bookman
NewCenturySchlbk
ZapfChancery
Courier
Palatino
ZapfDingbats
Helvetica
Symbol

So, if you use one of the above fonts, the output vector-format figure should maintain the correct font. See for example:

list_fonts = listfonts
figure('renderer','painters'),
plot(peaks),
xlabel('this font is Helvetica','fontname','Helvetica','fontsize',24)
set(gcf,'paperpositionmode','auto')
print(gcf,'-depsc2','test1.eps')

Which produces:

So, choose one of the fonts from the list above, and the font will be output correctly. Otherwise, change the font in your presentation to match one of the above fonts.




回答2:


I also encountered this problem for many times, and I have an simple but effective way that never fails me (on Windows, need GSview).

1) save fig as PDF

2) save PDF as ps

3) open ps with GSview, then click "File->PS to EPS", specify a file name and done.

Hope this helps.



来源:https://stackoverflow.com/questions/16846941/is-it-possible-to-get-around-matlabs-limitation-on-font-embedding-in-vector-for

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!