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
awidthshow (Number cx, Number cy, int code, Number ax, Number ay, String str [, double alpha]) typedict.Graphics
 
Draws the characters in str on drawable starting at the current point, which is adjusted as the characters in str are printed. Character outlines come from font and are painted using foreground and the optional alpha argument, which should be a number between 0.0 and 1.0, as the alpha value. Omitting alpha or supplying a value of 1.0 are equivalent. awidthshow aborts with a nocurrentpoint error if path is empty.

awidthshow always processes the characters in str individually, even when ax, ay, cx and cy are zero, and it can be used when the combined the behavior of ashow and widthshow is needed. The first character in str is placed at the current point, which is adjusted horizontally by the width of that character plus ax and vertically by ay plus an additional cx horizontally and cy vertically when that character matches code, before the second character is printed. The process stops after the last character in str is printed.
 
 Example:   The program,
import yoix.*.*;

JFrame f = {
    Graphics graphics = {
        String font = "Lucida-bold-24";
        Color  foreground = Color.red;
    };

    paint(Rectangle r) {
        String text = "hello, world";

        graphics {        // "named block"
            gsave();
            rectclip(r);
            translate(drawable.size.width/2, drawable.size.height/2);
            moveto(-stringwidth(text)/2, 0);
            awidthshow(9, 0, 'l', 0, 3, text);
            grestore();
        }
    }
};

f.visible = TRUE;
defines a paint function in a frame that draws a string of characters near the center of the frame using awidthshow.
 
 Return:   none
 
 See Also:   ashow, charpath, imagepath, kshow, show, showimage, stringadvance, stringbounds, stringwidth, widthshow

 

Yoix is a registered trademark of AT&T Inc.