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
shearfont (Number shx, Number shy) typedict.Font
 
Returns a new Font that is created by applying a horizontal shearing of shx and a vertical shearing of shy to every character in this font. A shearing transformation translates the point
(x, y)
to the point,
(x + shx*y, y + shy*x)
which means x-coordinates are shifted horizontally by an amount that depends on their distance from the y-axis, and y-coordinates are shifted vertically by an amount that depends on their distance from the x-axis.
 
 Example:   Here is a small program,
import yoix.*.*;

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

Font SHEAR1 = SHEAR0.shearfont(-.5, 0);
Font SHEAR2 = SHEAR1.shearfont(-.5, 0);
Font SHEAR3 = SHEAR2.shearfont(-.5, 0);

JFrame f = {
    Color background = Color.white;

    Graphics graphics = {
        int textantialiasing = TRUE;
    };

    paint(Rectangle rect) {
        graphics {
            gsave();
            stroke();
            rectclip(rect);
            moveto(36, 144);
            rlineto(72*5, 0);
            stroke();
            moveto(36, 144);
            setfont(SHEAR0);
            show("It's ");
            setfont(SHEAR1);
            show("getting ");
            setfont(SHEAR2);
            show("very ");
            setfont(SHEAR3);
            show("windy");
            grestore();
        }
    }
};

f.visible = TRUE;
that creates three fonts using shearfont and then defines a paint function in a frame that draws a short line that represents the baseline and shows a few words using the available fonts.
 
 Return:   Font
 
 See Also:   rotatefont, scalefont, transformfont, translatefont

 

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