Chapter Contents




Specifies the orientation (angle) of the text string

Operating States: GKOP, SGOP, WSAC, WSOP
Return Codes: 0, 8, 74
Default Values: upx=0, upy=1

Argument Definitions
See Also


return-code-variable=GSET('TEXUP',upx, upy);


The GSET('TEXUP', . . . ) function sets the angle of the text string. DSGI uses the values of character up vectors to determine the angle of a text string. The character up vector has two components, upx and upy, that describe the angle at which the text string is placed. The angle is calculated with the following formula:


Effectively, when DSGI is calculating the angle for the text, it uses upx and upy as forces that are pushing the string toward an angle. The natural angle of text in the upx direction is toward the 6 o'clock position. In the upy direction, text naturally angles at the 3 o'clock position. If upx is greater than upy, the text is angled toward 6 o'clock. If upy is greater than upx, the text is angled toward 3 o'clock. Natural Angle of Text shows the angle of text when the values for upx and upy are (0.0, 1.0) and (1.0, 0.0).

Natural Angle of Text


As you change the values of upx and upy, the coordinate that has the highest value is taken as the angle, and the lowest value as the offset. Varying the Angle of Text shows the angle of text when the character up vector values (+1.0, +0.5) are used.

Varying the Angle of Text


You can use the following macro to convert angles measured in degrees to character up vectors:

%macro angle(x);
 if  mod(&x, 180)=90 then do;
    if mod(&x,270) = 0 then
       xup = 1.0;
       xup = -1.0;
    rc = gset('texup', xup, 0.0);
 else do;
    b = mod(&x, 360);
    /* adjust y vector for 2nd and 3rd quadrants */
    if b > 90 and b lt 270 then
      yup = -1.0;
      yup = 1.0;
    xup = tan(-a);
    /* adjust x vector for 3rd quadrant */
    if b > 180 and b le 270 then
      xup = -xup;
    rc = gset('texup', xup, yup);
%mend angle;

data _null_;
  rc = ginit();
  rc = graph('clear', 'angle');
  rc = gset('texalign', 'left', 'base');
  rc = gset('texheight', 5);
  rc = gset('texfont', 'swissl');
  rc = gdraw('text', 50, 50, '180');
  rc = gdraw('text', 50, 50, '80');
  rc = gdraw('text', 50, 50, '600');
  rc = graph('update');
  rc = gterm();

Argument Definitions

upx numeric constant or numeric variable name; if upy is 0, upx cannot be 0.
upy numeric constant or numeric variable name; if upx is 0, upy cannot be 0.

See Also

GASK('TEXUP', . . . ) routine
GDRAW('TEXT', . . . ) function
GSET('TEXALIGN', . . . ) function
GSET('TEXPATH', . . . ) function

Chapter Contents



Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.