Font Metrics

The font metrics command returns measurement information for fonts. It returns general information about all the characters in the font:

font metrics {times 10}
-ascent 9 -descent 2 -linespace 11 -fixed 0
					

The fixed setting is true for fonts where each character fits into the same-sized bounding box. The linespace is the distance between the baselines of successive lines. The ascent and descent are illustrated in Example 39-2:

Example 39-2 Font metrics.

The font measure command returns the width of a string that will be displayed in a given font. The width does not account for heavily slanted letters that overhang their bounding box, ...

Get Practical Programming in Tcl & Tk, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.