MATLAB App Designer does not render new fonts

2 ビュー (過去 30 日間)
Daniel Vieira
Daniel Vieira 2019 年 7 月 23 日
コメント済み: lalit bindra 2020 年 6 月 1 日
I needed an illegible font for an app that requires a password, and there wasn't any in the App Designer default fonts, so I donwloaded one. I installed an openType font, restarted MATLAB (as in here), tested the font in a figure window using the "text" function, and it works. However, in the App Designer, the font appears in the list of fonts for an Edit Field, but is rendered as the default font. Is it even possible to use new fonts in App Designer? If it is, what am I missing?
A print of what's happening (roll to the right, this print turned unnecessarily big...)
  2 件のコメント
Adam Danz
Adam Danz 2019 年 7 月 23 日
Have you closed the app and restarted it since making the change?
If no, try that first.
If yes, have you tried assigning the fontname within a callback function?
Use listfonts() to list all available fonts in Matlab.
A bigger question: Is this really the best encryption method? Here are alternatives listed by Jan [1] and Stephen Cobeldick [2].
Daniel Vieira
Daniel Vieira 2019 年 7 月 23 日
Ok, I tried both suggestions, and neither worked. I'll make a "real encryption" then...

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

回答 (1 件)

Subhadeep Koley
Subhadeep Koley 2019 年 8 月 9 日
Hi, follow the steps below to achieve the same
  1. In the Editor tab of the App Designer click on the Public Property and insert the follwing code
password;
2. Right click on the text field > go to EditFieldValueChanging callback
3. paste the following code inside the callback
c=event.Value;
app.password = [app.password, c(end:end)];
set(app.EditField, 'Value', [repmat('*', 1, length(c))]);
4. Save & Run the App
The Actual value of the password is stored inside the variable app.password.
  2 件のコメント
Daniel Vieira
Daniel Vieira 2019 年 8 月 9 日
I already solved, quite similar to your suggestion, but with some extra steps to allow the user to take back characters. The problem is it turned out to be slow, a character may be lost if I type too fast. That's ok for now.
But I'd really like to be able to use new fonts, not necessarily for this.
lalit bindra
lalit bindra 2020 年 6 月 1 日
Can you please share the edited code. I tried the code by Subhadeep but it changes the user input to the asterisks.

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

カテゴリ

Help Center および File ExchangePackage and Share Apps についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by