Using TrueType Fonts on MATLAB Plots

7 ビュー (過去 30 日間)
Christopher Wilcox
Christopher Wilcox 2020 年 8 月 27 日
編集済み: Karthick SK 2021 年 8 月 25 日
I am attempting to use a font (Wingdings) that is installed on my system and works on MS Word (Win10). I'm using MATLAB R2019b
My code is
figure(1);
x = 1:5;
y = 1:5;
z = round(2*ones(1,5));
% plot3(x, y, z, 'ok');
plot(x, z, 'ok');
text(1.5, 1.5, 'Some Text', 'fontname', 'Wingdings', 'fontsize', 50);
% text(1.5, 1.5, '\fontname{Wingdings} Some Text', 'fontsize', 50);
I have tried Tex, as well, and setting the fontname field only shows recatngles instead of text
Any font listed under listfonts seems to work, however, fonts listed under listTrueTypeFonts (which Wingdings is) seems to show work also, except for Wingdings and a handful of others. Has anyone else seen this behavior? After searching the support forum for a while, I have tried many things with the same results. Any help is greatly apprciated. Thank you.
  1 件のコメント
Karthick SK
Karthick SK 2021 年 8 月 25 日
編集済み: Karthick SK 2021 年 8 月 25 日
It does not work in 'Windows' machine! There is a roundabout to tackle this problem.
figure(1);
x = 1:5;
y = 1:5;
z = round(2*ones(1,5));
% plot3(x, y, z, 'ok');
plot(x, z, 'ok');
text(1.5,1.5,[char(0x2B2E) char(0x2B2C) char(0x2B2F) char(0x2B2E) char(0x2721)],'fontname','ZapfDingbats','fontsize',20); % char in hexadecimal code
Kindly refer the answers in the following thread:
  1. https://www.mathworks.com/matlabcentral/answers/93787-how-do-i-use-custom-markers-for-a-line-object-in-a-matlab-plot
  2. https://www.mathworks.com/matlabcentral/answers/344159-how-can-i-create-elliptical-shaped-markers
  3. https://www.mathworks.com/matlabcentral/answers/102092-why-am-i-unable-to-display-certain-characters-in-the-upper-ascii-range-in-the-title-of-my-plot-in-ma
  4. https://www.mathworks.com/matlabcentral/answers/18122-wingdings-and-other-symbol-fonts-appear-as-default-font
They all adopt a similar approach which is effective.
(Credits: Kannan Munusamy. My friends found this way as efficient and the credits go to him)

サインインしてコメントする。

回答 (1 件)

Ayush Gupta
Ayush Gupta 2020 年 9 月 4 日
I have brought this issue to the notice of our developers. They will investigate the matter further.
  2 件のコメント
Christopher Wilcox
Christopher Wilcox 2020 年 9 月 4 日
Thank you!
Okuary Osechas
Okuary Osechas 2021 年 6 月 28 日
I have the same problem.
Have your developers had the chance to "investigate the matter further"?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Import and Export についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by