beetlebug▾
/

font measure

Gives the width of a text in a font, in pixels.

font measure FONT ?-displayof WINDOW? TEXT

Description

Gives the count of pixels from the start of TEXT to its end in FONT. An empty text gives 0.

Returns

A count of pixels.

Examples

% font measure {Courier 12} abc
29

% font measure TkDefaultFont {}
0

Errors

% font measure x
wrong # args: should be "font measure font ?-displayof window? text"
-errorcode TCL WRONGARGS

Facts

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

See also