Comments on: Font selection components https://undocumentedmatlab.com/blog_old/font-selection-components Charting Matlab's unsupported hidden underbelly Thu, 02 May 2024 08:00:01 +0000 hourly 1 https://wordpress.org/?v=4.4.1 By: Volkmarhttps://undocumentedmatlab.com/blog_old/font-selection-components#comment-358980 Thu, 15 Oct 2015 10:07:20 +0000 https://undocumentedmatlab.com/?p=6013#comment-358980 Although uisetfont is a stock MATLAB UI for font selection, its output is not directly usable when creating new graphics/ui objects: Graphics objects do not accept the struct itself as a font specification (at least not in HG2). One needs to convert this struct into a list of key/value pairs to actually use it as font specifications. Something like this

fs = uisetfont;
keys    = fieldnames(fs);
values  = struct2cell(fs);
keyvals = [keys'; values'];
keyvals{:}

creates a key/value cell array, which can be inserted using colon expansion when font properties need to be specified.

]]>
By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/font-selection-components#comment-358531 Thu, 08 Oct 2015 08:08:41 +0000 https://undocumentedmatlab.com/?p=6013#comment-358531 @Mikhail – read my section on using a uicontrol – this is exactly what I did there.

]]>
By: Mikhailhttps://undocumentedmatlab.com/blog_old/font-selection-components#comment-358530 Thu, 08 Oct 2015 08:02:11 +0000 https://undocumentedmatlab.com/?p=6013#comment-358530 Hey Yair,

There is a listfonts command in MATLAB. I guess you can use its output to populate font selection dialog in your application.

]]>