MATLAB Answers

Undocumented style of changing matlab font

조회 수: 7(최근 30일)
I'm reading "Undocumented Secrets of matlab-java programming" by Yair Altman and try to change editor's font by means which are described in this book, but it has explicit examples only for color. Anyway, I managed to change font in matlab.prf by the following code:
FontName = "Consolas";
javaLangString = java.lang.String(FontName);
javaAwtFont = java.awt.Font(javaLangString,0,10);'Desktop.Font.Code2',javaAwtFont);
It does change font in preferences but doesn't press "apply" button. In other words it doesn't refresh environment font but change it in configuration file (matlab.prf). In case of color it was solved by this:'ColorsBackground');
It there any way to do this for font?

  댓글 수: 1

Greg 10 Jan 2018
What's wrong with the normal preferences option for changing Editor font?

댓글을 달려면 로그인하십시오.

채택된 답변

Yair Altman
Yair Altman 10 Jan 2018
The FontPrefs class contains other useful static methods to set/get the text and code fonts, and to convert from the display font to the [larger] Java font (note: only the font-size changes) or vice-versa. Use my checkClass or uiinspect utilities (on the File Exchange) to investigate what this class offers.
Yair Altman

  댓글 수: 2

Rostislav Teryaev
Rostislav Teryaev 10 Jan 2018
Thank you for your answer and book!
Yair Altman
Yair Altman 10 Jan 2018
My pleasure - please be kind enough to place a positive review about the book on Amazon:

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by