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:
-ascent: the pixels from the base line to the top of the tallest letter.-descent: the pixels from the base line to the bottom of the lowest letter.-linespace: the pixels from one line of text to the next, the sum of the two.-fixed: 1 when each character has the same width, and else 0.
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