User`s guide

11 Lay Out a Programmatic GUI
Design Programmatic GUIs for Cross-Platform
Compatibility
In this section...
“Default System Font” on page 11-94
“Standard Background Color” on page 11-95
“Cross-Platform Compatible U nits” on page 11-96
Default System Font
By default, user interface controls (uicontrols) use the default font for the
platform on which they are running. F or example, when displaying your GUI
on PCs, user interface controls use MS San Serif. When your GUI runs on
a different platform, they u se that com puter’s default font. This provides a
consistent look with respect to your GUI and other application GUIs on the
same platform.
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 that MATLAB software uses the system default at run-time.
You can use the
set com m and to set this property. For example, if there is a
push button with handle
pbh1 in your GUI, then the statement
set(pbh1,'FontName','default')
sets the FontName property to use the system default.
Specify a Fixed-Width Font
If you w ant to use a fixed-width font for a user interface control, set its
FontName property to the string fixedwidth. This special identifier ensures
that your GUI uses the standard fixed-width font for the target platform.
You can find the name of the fixed-w idth font that is used on a given platform
by querying the root
FixedWidthFontName property.
get(0,'FixedWidthFontName')
11-94