Installed font not working when saving figure

4 次查看(过去 30 天)
Hi
I have installed a computer modern font on my win 7 machine to use it when plotting figures in matlab. The figure I get on the screen uses this font, but in the .eps file generated using saveas or print is with another font. If I use a standard font like 'Times' I get the right font in the .eps files. The code I use is the following:
set(0, 'defaultaxesfontname', 'CMU Serif'); % Computer modern.
set(0, 'defaulttextfontname', 'CMU Serif');
% set(0, 'defaultaxesfontname', 'Times'); % Times new roman.
% set(0, 'defaulttextfontname', 'Times');
set(0, 'defaultaxesfontsize',8);
set(0, 'defaulttextfontsize',8);
h = figure('units','pixels ','position',[0 0 100 200]);
plot([1,2],[1,2]
set(gca, 'OuterPosition', [-0.01 -0.005 0.99 0.99]);
set(gcf, 'PaperPositionMode', 'manual'); % Setup figure size
set(gcf, 'PaperUnits', 'centimeters ');
set(gcf, 'PaperPosition', [0 0 figWidth figHeight]);
saveas(h,'figure.eps', 'psc2')
print -depsc figure
Does anyone knows what the problem is?
Thanks in advance!
Regards Brian.
  1 个评论
Brian Bak
Brian Bak 2012-7-27
The fonts I have installed can be found at this link: http://canopus.iacp.dvo.ru/~panov/cm-unicode/download.html
It is the .otf files i have installed.
If i print to .pdf from the figure window I get the right font but if i use saveas from the figure window it uses the default font in matlab.

请先登录,再进行评论。

回答(1 个)

Fadime Bekmambetova
A workaround that worked for me was to save as .svg and use Inkscape to create a PDF.

类别

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

标签

Community Treasure Hunt

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

Start Hunting!

Translated by