Modify font characteristics for objects interactively
Syntax
uisetfont
uisetfont(h)
uisetfont(S)
uisetfont(h,'DialogTitle
')
uisetfont(S,'DialogTitle
')
S = uisetfont(...)
Description
uisetfont
enables you to change font properties (FontName
, FontUnits
, FontSize
, FontWeight
, and FontAngle
) for a Text, Axes, or Uicontrol object. The function returns a structure consisting of font properties and values. You can specify an alternate title for the dialog box.
uisetfont
displays the dialog box and returns the selected font properties.
uisetfont(h)
displays a dialog box, initializing the font property values with the values of those properties for the object whose handle is h
. Selected font property values are applied to the current object. If a second argument is supplied, it specifies a name for the dialog box (ignored on the Macintosh).
uisetfont(S)
displays a dialog box, initializing the font property values with the values defined for the specified structure (S
). S
must define legal values for one or more of these properties: FontName
, FontUnits
, FontSize
, FontWeight
, and FontAngle
and the field names must match the property names exactly. If other properties are defined, they are ignored. If a second argument is supplied, it specifies a name for the dialog box (ignored on the Macintosh).
uisetfont('DialogTitle
')
displays a dialog box with the title DialogTitle
and returns the values of the font properties selected in the dialog box. The Macintosh ignores this argument.
If a left-hand argument is specified, the properties FontName
, FontUnits
, FontSize
, FontWeight
, and FontAngle
are returned as fields in a structure. If the user presses Cancel from the dialog box or if an error occurs, the output value is set to 0.
Example
These statements create a Text object, then display a dialog box (labeled Update Font) that enables you to change the font characteristics:
h = text(.5,.5,'Figure Annotation');
uisetfont(h,'Update Font')
These statements create two Uicontrol objects, then set the font properties of one based on the values set for the other:
% Create push button with string ABC
c1 = uicontrol('Style', 'pushbutton', ...
'Position', [10 10 100 20], 'String', 'ABC');
% Create push button with string XYZ
c2 = uicontrol('Style', 'pushbutton', ...
'Position', [10 50 100 20], 'String', 'XYZ');
% Display set font dialog box for c1, make selections, save to d
d = uisetfont(c1)
% Apply those settings to c2
set(c2, d)
See Also
axes
, text
, uicontrol
[ Previous | Help Desk | Next ]