This is plhrsh.c in view mode; [Download] [Up]
/* Writes the Hershey symbol "ch" centred at the physical */
/* coordinate (x,y) */
#include "plplot.h"
void plhrsh(ch,x,y)
int ch, x, y;
{
int cx, cy, k, penup;
SCHAR *xygrid;
double symdef, symht, scale, xscale, yscale, xpmm, ypmm;
gsym(&symdef,&symht);
gpixmm(&xpmm,&ypmm);
penup = 1;
scale = 0.05 * symht;
if (!plcvec(ch,&xygrid)) {
movphy(x,y);
return;
}
/* Compute how many physical pixels correspond to a character pixel */
xscale = scale * xpmm;
yscale = scale * ypmm;
k = 4;
for(;;) {
cx = xygrid[k++];
cy = xygrid[k++];
if (cx == 64 && cy == 64) {
movphy(x,y);
return;
}
else if (cx == 64 && cy == 0)
penup = 1;
else {
if (penup != 0) {
movphy(round(x+xscale*cx),round(y+yscale*cy));
penup = 0;
}
else
draphy(round(x+xscale*cx),round(y+yscale*cy));
}
}
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.