AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
stringsize (String str [, int tight]) typedict.Font
 
Returns a Dimension that represents the width and height of the string str in user space if it were printed using this font. The optional tight argument, which is 0 by default, controls the fit of the Dimension to the str.

By default the result is a "loose fitting" Dimension that covers the origin and the advance point, which is the where the current point (i.e., the origin) moves after str is printed, and extends ascent units above and descent units below the baseline, which is the line that connects the origin to the advance point. If the optional tight argument is supplied and is non-zero then the result will be a "tight fitting" Dimension that just covers the characters in str.

stringsize and stringbounds are closely related. In fact the width and height that you get from stringsize are also available in the Rectangle that stringbounds returns, but the fact that the answer is a Dimension means stringsize can be used to initialize fields like size and preferredsize that are found in most Swing and AWT components.
 
 Return:   Dimension
 
 See Also:   stringbounds, stringfit, stringwidth

 

Yoix is a registered trademark of AT&T Inc.