Creating a fast forward button with consistent visuals

22 次查看(过去 30 天)
I have been making some audio control buttons such as a play button with:
uibutton(Text=char(0x23F5), FontName="monospaced")
Note that I am using the "Monospaced" font, which MATLAB is using for the editor and command window by default. This button shows the same symbol that would show in the command window if I were to print the text. This is the same for most of the media UTF-8 symbols.
However, if I run the same command, but using the code for the fast forward button, I get a different style symbol, despite explicitly defining the font that I want the button to use.
uibutton(Text=char(0x23E9), FontName="monospaced")
My question is what is causing this discrepancy, and how can I mitigate this?

采纳的回答

Matthew Moschella
Matthew Moschella 2025-12-10,16:06
Did some investigating, seems like the uibutton uses the "Segoe UI Emoji" font when the text is a UTF-8 symbol.
I also see the 'all-black' version of the fast-forward button when I enter char(0x23E9) in the command window. If you copy and pase this into a Word document the symbol changes to the blue version you are seeing and the font is listed as "Segoe UI Emoji". Interestingly though, if you enter char(0x23F5) in the command window and copy that into a Word document you get a 'tofu' symbol.
Based on some google searching it appears that the Segoe UI Emoji font doesn't have a supported icon for the 0x23F5 symbol but it does have one for the 0x23E9 symbol. I imagine when MATLAB attempts to 'render' the 0x23F5 it is defaulting to another font that does have a supported symbol. Having said that, it's unclear why MATLAB is forcing a font other than the 'Monospaced' that you have declared.
I think the easiest solution is to use the 'Icon' property of uibutton to instead display images of these symbols.
  1 个评论
Damien Watson
Damien Watson 2025-12-10,16:51
Hmm, looks like you may be right. It is a shame to have to resort to using an icon (with SVG for infinite scaling), but I guess that might be the best solution for now.

请先登录,再进行评论。

更多回答(0 个)

标签

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by