Installed font not working when saving figure

7 vues (au cours des 30 derniers jours)
Brian Bak
Brian Bak le 26 Juil 2012
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 commentaire
Brian Bak
Brian Bak le 27 Juil 2012
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.

Connectez-vous pour commenter.

Réponses (1)

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

Catégories

En savoir plus sur Printing and Saving dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by