Stringwidth – AMT Datasouth PAL User Manual
Page 190

stringwidth
184
stringwidth
Description
Returns the current point relative movement which would occur if the user were to draw a given
string using the show operator.
Usage
AnyStr
stringwidth
XDeltaNum YDeltaNum
AnyStr
String. The string for which PAL will calculate the current point relative
movement.
XDeltaNum
Integer or fixed-point. Relative movement along the X axis.
YDeltaNum
Integer or fixed-point. Relative movement along the Y axis.
Comments
The stringwidth operator allows a PAL procedure to calculate the distance a given string will
cause the current point to advance after drawing the string using the show operator. The
stringwidth operator does not actually draw the string. stringwidth performs the same current
point movement calculations as show, but without drawing the string.
The operator returns the relative movement along both the X and Y axis. For Roman character set
based languages, the interpreter will normally return zero for YDeltaNum and a positive value for
XDeltaNum. However, other languages may draw their characters from left to right or vertically.
These languages can produce a different range of possible values for XDeltaNum and
YDeltaNum.
Comments
The stringwidth provides the means for a PAL procedure to automatically center or, in the case of
Roman character set languages, right-justify text. The operator also provides the means for non-
Roman character set languages to perform equivalent justifications.
The following PAL procedure will perform the same operation as the PAL show operator,
however the procedure will automatically center the text over the current point.
/CShow {
dup stringwidth
exch 2 div exch 2 div rmoveto
show
} bind def
The CShow procedure has the same usage as the show operator.
ShowStr
CShow
For Roman text, the show operator draws ShowStr with the left bottom corner at the current
point. The CShow procedure draws ShowStr with the center point of the bottom edge at the
current point.