Font Metrics

   

Practical Programming in Tcl & Tk, Third Edition
By Brent B. Welch

Table of Contents
Chapter 39.  Fonts and Text Attributes


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.

graphics/39fig01.gif

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, nor does it do anything special with tabs or newlines in the string.


       
    Top
     



    Practical Programming in Tcl and Tk
    Practical Programming in Tcl and Tk (4th Edition)
    ISBN: 0130385603
    EAN: 2147483647
    Year: 1999
    Pages: 478

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net