Specifications

Designing for Cross-Platform Compatibility
4-15
Designing for Cross-Platform Compatibility
You can use specific property settings to create a GUI that behaves more
consistently when run on different platforms:
Use the default font (uicontrol
FontName property).
Use the default background color (uicontrol
BackgroundColor property).
Use figure character units (figure
Units property).
Using the Default System Font
By default, uicontrols use the default font for the platform on which they are
running. For example, when displaying your GUI on PCs, uicontrols uses MS
San Serif. When your GUI runs on a different platform, it uses that computer’s
default font. This provides a consistent look with respect to your GUI and other
application GUIs.
If you have set the
FontName property to a named font and want to return to
the default value, you can set the property to the string
default. This ensures
MATLAB uses the system default at runtime.
From within the application M-file, use the set command. For example, if there
is a push button in your GUI and its handle is stored in the
pushbutton1 field
of the
handles structure, then the statement,
set(handles.pushbutton1,'FontName','default')
sets the FontName property to use the system default. You can also use the
Property Inspector to set this property: