Borrar filtros
Borrar filtros

The word's font are not consistent.

8 visualizaciones (últimos 30 días)
Omari
Omari el 29 de Jul. de 2024
Comentada: Omari el 5 de Ag. de 2024
I use the script to edit chinese, the font of output pdf file is not consistent with orignal script's font.
orignal script file:
output file(pdf):

Respuestas (1)

Abhas
Abhas el 31 de Jul. de 2024
Hi Omari,
To address the issue of font inconsistency between your original MATLAB script and the output PDF, you can specify the desired font in your MATLAB script before exporting to PDF. This ensures that the output PDF matches the appearance of your script by setting the "ContentType" to "vector".
You can follow the below steps to do so:
% Set default font
set(0, 'DefaultTextFontName', 'SimHei');
set(0, 'DefaultAxesFontName', 'SimHei');
% Create a figure
figure;
% Add text with Chinese characters
text(0.5, 0.5, '中文字符', 'FontName', 'SimHei', 'FontSize', 12, 'HorizontalAlignment', 'center');
% Set axis properties
axis([0 1 0 1]);
set(gca, 'XTick', [], 'YTick', []);
% Export to PDF
exportgraphics(gcf, 'output.pdf', 'ContentType', 'vector');
You may refer to the following MathWorks documentation link and MATLAB Answers Link to have a better understanding on customizing font of MATLAB workspace and saving content to a file:
  1. https://www.mathworks.com/matlabcentral/answers/2114596-how-to-adjust-font-settings-for-labelling-text-used-in-the-command-window-and-variables-panes-as-w
  2. exportgraphics: https://www.mathworks.com/help/matlab/creating_plots/printing-and-exporting.html
  1 comentario
Omari
Omari el 5 de Ag. de 2024
Thanks your answer, but it doesn't solve my problem. I want use this method to generate pdf file.

Iniciar sesión para comentar.

Categorías

Más información sobre Printing and Saving en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by