Matlab Plot - Font Zapf Dingbats Will Not Render

谁说胖子不能爱 提交于 2019-12-02 01:29:10

问题


I have a Matlab program where I need to include a plane icon (Zapf Dingbats 40) in the plot. Everytime I run it, it falls back to a system font.

Is there anything that I am doing wrong? This is not the exact code, but illustrates the problem:

title(char(40),'fontname','ZapfDingbats','fontsize',50);

The resulting plot always displays ( instead of the Dingbats plane icon .

I verified that the font is installed and I can type with it on Word.

I am using Matlab R2013b on Mac OSX 10.9.1.

EDIT: It prints correctly to a pdf, but does not display correctly.


回答1:


You may use the 'Wingdings' font for that. The following code

text(0.5, 0.5, char(81), 'fontname', 'Wingdings', 'fontsize',50);

gives

The 'ZapfDingbats' font may not be in the /Library/Font folder (but 'Wingdings' is), even if listfonts tells you that the font is there. Actually, the listfonts function adds some extra fonts to the list of the available fonts, and I don't get the rational of that.

% always add postscipt fonts to the system fonts list.
systemfonts = [fonts;
    {
    'AvantGarde';
    'Bookman';
    'Courier';
    'Helvetica';
    'Helvetica-Narrow';
    'NewCenturySchoolBook';
    'Palatino';
    'Symbol';
    'Times';
    'ZapfChancery';
    'ZapfDingbats';
    }];


来源:https://stackoverflow.com/questions/21179447/matlab-plot-font-zapf-dingbats-will-not-render

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!