| widthshow |
(Number cx, Number cy, int code, 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.
widthshow
aborts with a
nocurrentpoint
error if
path
is empty.
widthshow
always processes the characters in
str
individually, even when
cx
and
cy
are zero, and is used to make positioning adjustments after one particular
character (e.g., a space) is printed.
The first character in
str
is placed at the current point, which is adjusted horizontally by the
width of that character 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);
widthshow(0, -3, 'l', 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
widthshow.
| | |
| Return: |
none
| | |
| See Also: |
ashow,
awidthshow,
charpath,
imagepath,
kshow,
show,
showimage,
stringadvance,
stringbounds,
stringwidth
|
|
Yoix is a registered trademark of AT&T Inc.
|