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

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YDAT | YWAIT | Byzgraf | FAQs
translatefont (Number tx, Number ty) typedict.Font
 
Returns a new Font that is created by applying a horizontal translation of tx and a vertical translation of ty to every character in this font.
 
 Example:   Here is a small program,
import yoix.*.*;

Font SUP0 = {
    String name = "Lucida-plain-30";
};

Font SUP1 = SUP0.translatefont(0, -SUP0.ascent).scalefont(.5);
Font SUP2 = SUP1.translatefont(0, -SUP1.ascent).scalefont(.5);

JFrame f = {
    Color background = Color.white;

    Graphics graphics = {
        int textantialiasing = TRUE;
    };

    paint(Rectangle rect) {
        graphics {
            gsave();
            rectclip(rect);
            moveto(36, 144);
            setfont(SUP0);
            show("2");
            setfont(SUP1);
            show("3");
            setfont(SUP2);
            show("4");
            setfont(SUP0);
            show(" = ");
            show(toString((int)pow(2, pow(3, 4))));
            grestore();
        }
    }
};

f.visible = TRUE;
that defines a paint function in a frame that evaluates and prints a simple math expression using fonts created by applying scalefont and translatefont to a base text font.
 
 Return:   Font
 
 See Also:   rotatefont, scalefont, shearfont, transformfont

 

Yoix is a registered trademark of AT&T Intellectual Property.