beetlebug▾
/

font configure

Gives or sets the attributes of a named font.

font configure NAME
font configure NAME OPTION
font configure NAME OPTION VALUE ?OPTION VALUE ...?

Description

With no option, gives each attribute and its value. With one OPTION, gives its value. With pairs, sets the attributes, and each widget that uses the font draws again with its new size. The options are the options of [font create](cmd:font create).

Returns

A list of options and values, a value, or an empty string.

Examples

% font create Body -family Times -size 11
> font configure Body
-family Times -size 11 -weight normal -slant roman -underline 0 -overstrike 0

% font create Grow -size 9
> label .l -text Hello -font Grow
> set h [winfo reqheight .l]
> font configure Grow -size 30
> expr {[winfo reqheight .l] > $h}
1

Errors

% font configure nofont
named font "nofont" doesn't exist
-errorcode NONE

% font create C1; font configure C1 -color red
bad option "-color": must be -family, -size, -weight, -slant, -underline, or -overstrike
-errorcode TCL LOOKUP INDEX option -color

% font create C2; font configure C2 -size 10 -weight
value for "-weight" missing
-errorcode NONE

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztk 1.0.0-beta.1

See also