ftp.nice.ch/pub/next/unix/developer/plplot.3.0.s.tar.gz#/plplot/src/plptex.c

This is plptex.c in view mode; [Download] [Up]

/* Prints out "text" at world cooordinate (x,y). The text may be       */
/* at any angle "angle" relative to the horizontal. The parameter      */
/* "just" adjusts the horizontal justification of the string:          */
/*   just = 0.0 => left hand edge of string is at (x,y)                */
/*   just = 1.0 => right hand edge of string is at (x,y)               */
/*   just = 0.5 => centre of string is at (x,y) etc.                   */
/* N.B. Centreline of the string passes through (x,y)                  */

#include "plplot.h"
#include <math.h>

void plptex(x,y,dx,dy,just,text)
double x,y,dx,dy,just;
char *text;
{
  int refx, refy;
  double shift, cc, ss;
  double xform[4],diag;
  double xscl, xoff, yscl, yoff;
  int level;

  glev(&level);
  if (level < 3) plexit("Please set up window before calling plptex.");

  gwm(&xscl,&xoff,&yscl,&yoff);
  cc = xscl * dx;
  ss = yscl * dy;
  diag = sqrt(cc*cc + ss*ss);
  cc = cc/diag;
  ss = ss/diag;

  gmp(&xscl,&xoff,&yscl,&yoff);
  shift = 0.0;

  xform[0] = cc;
  xform[1] = -ss;
  xform[2] = ss;
  xform[3] = cc;

  if (just != 0.0) shift = plstrl(text) * just;
  refx = wcpcx(x) - shift * cc * xscl;
  refy = wcpcy(y) - shift * ss * yscl;
  plstr(0,xform,refx,refy,text);
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.