Font problems when exporting as an .eps
조회 수: 14 (최근 30일)
이전 댓글 표시
Hello I would like to export my plot as an .eps file of the following code:
set(0,'defaulttextinterpreter','latex')
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];
end
end
x=[x -x 0]; % Add all negative numbers and 0
x = sort(x); % Sort
y = zeros(1,length(x));
plot(x,y,'+')
xlabel('numbers available')
The problem is that when i run the script the figure's window opening has the required fonts:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/803959/image.png)
But the eps file has the font of all the numbers wrong:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/803964/image.png)
What can I do?
Thanks
댓글 수: 0
답변 (1개)
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).
exportgraphics(fig, 'output.pdf');
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.
댓글 수: 1
engdancili
2022년 8월 11일
편집: engdancili
2022년 8월 11일
Unfortunately it also happens when converting a figure with custom symbols (minus sign instead of hyphen character) to pdf. It seems there is no workaround to this. Why not giving the option to convert all fonts to glyphs instead of embedding them?
P.s. - However, it does work when converting to .eps: the minus sign is included.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1094250/image.png)
참고 항목
카테고리
Help Center 및 File Exchange에서 Printing and Saving에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!