beetlebug▾
/

font metrics

Gives the heights of a font and tells if its characters have one width.

font metrics FONT ?-displayof WINDOW? ?OPTION?

Description

Gives the four metrics, or the value of one OPTION:

Returns

A list of metrics and values, or one value.

Examples

% font metrics {Courier 12} -fixed
1

% font metrics {Helvetica 12} -fixed
0

% lassign [font metrics {Helvetica 12}] - a - d - l
> expr {$a + $d == $l}
1

Errors

% font metrics {Courier 12} -width
bad metric "-width": must be -ascent, -descent, -linespace, or -fixed
-errorcode NONE

% font metrics {Courier 12} -ascent -descent
wrong # args: should be "font metrics font ?-displayof window? ?option?"
-errorcode TCL WRONGARGS

Facts

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

See also