Font problems when exporting as an .eps
조회 수: 8(최근 30일)
Hello I would like to export my plot as an .eps file of the following code:
set(0,'DefaultAxesFontName', 'LM Roman 10')
x = ;
% Generate all positive numbers of the system (2,3,-2,3)
for i = 1:0.25:1.75
for j = -2:3
x = [x i*2^j];
x=[x -x 0]; % Add all negative numbers and 0
x = sort(x); % Sort
y = zeros(1,length(x));
The problem is that when i run the script the figure's window opening has the required fonts:
But the eps file has the font of all the numbers wrong:
What can I do?
Richard Quist 2021년 11월 29일
Font support in MATLAB-generated Postscript/Encapsulated Postscript is limited. Unsupported fonts are usually replaced by 'Courier' which is what appears to be happening in your figure.
If PDF is an acceptable format you can use the exportgraphics function in R2020a and later and it will embed the font in the output file if possible (not all fonts support embedding).
The PDF file generated by exportgraphics is typically tightly cropped, eliminating the margins that are normally included when generating PDF files with the print command.