By default, user interface controls (uicontrols) use the default font for the platform on which they are running. For example, when displaying your UI on PCs, user interface controls use MS San Serif. When your UI runs on a different platform, they use that computer's default font. This provides a consistent look with respect to your UI and other applications on the same platform.
If you have set the
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.
pbh1.FontName = 'default';
If you want to use a fixed-width font for a user interface control,
FontName property to the string,
This special identifier ensures that your UI uses the standard fixed-width
font for the target platform.
You can find the name of the fixed-width font that is used on
a given platform by querying the root
You can specify an actual font name (such as Times or Courier)
FontName property. However, doing so may
cause your UI to appear differently than you intended when run on
a different computer. If the target computer does not have the specified
font, it substitutes another font that may not look good in your UI
or may not be the standard font used on that system. Also, different
versions of the same named font may have different size requirements
for a given set of characters.
MATLAB uses the standard system background color of the system on which the UI is running as the default component background color. This color varies on different computer systems, e.g., the standard shade of gray on the PC differs from that on UNIX® system, and may not match the default UI background color.
You can make the UI background color match the default component background color. This code gets the default component background color and assign it to the figure.
defaultBackground = get(groot,'defaultUicontrolBackgroundColor'); fh.Color = defaultBackground;