diff options
Diffstat (limited to 'graphics/hpgl2ps/textps.c')
-rw-r--r-- | graphics/hpgl2ps/textps.c | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/graphics/hpgl2ps/textps.c b/graphics/hpgl2ps/textps.c new file mode 100644 index 0000000000..035df13cbb --- /dev/null +++ b/graphics/hpgl2ps/textps.c @@ -0,0 +1,116 @@ +#include "defn.h" + +#define MAXBUFSIZE 100 + +textps(type) +int type; +{ + char string[4]; + char buffer[MAXBUFSIZE]; + float Xch, Ych; + int intval; + int i; + + end_draw(); + + if (type == TEXT) + { + for (i = 0 ; i < MAXBUFSIZE; i++) /* Clear buffer */ + buffer[i] = NULL; + + i = 0; /* Reset buffer counter */ + + while (((ch = getc(stream)) != EOF) + && ch != CR && ch != LF && ch != EOL) + { + buffer[i++] = ch; +/* printf("%g %g 1 %g (%c) Text\n", absX, absY, char_angle, ch); + * absX += (char_width + char_space) * cos(char_angle * deg_rad); + * absY += (char_width + char_space) * sin(char_angle * deg_rad); + */ + } + printf("%g %g 1 %g (%s) Text\n", absX, absY, char_angle, buffer); + } else /* Must be a MARK */ + { + int symb_num; + + if (SIGNED_NUMERIC) + symb_num = getval(); + else + { + fprintf(stderr, + "Error: expecting a symbol number not %c (%d)", + symb_num, symb_num); + exit(1); + } + intval = (int)(getval() + 0.5); + switch (intval) + { + case 0: + strcpy(string, "*"); + break; + + case 1: + strcpy(string, "+"); + break; + + case 2: + strcpy(string, "#"); + break; + + case 3: + strcpy(string, "@"); + break; + + case 4: + strcpy(string, "%"); + break; + + case 5: + strcpy(string, "|"); + break; + + case 6: + strcpy(string, "="); + break; + + case 7: + strcpy(string, "&"); + break; + + case 9: + strcpy(string, "O"); + break; + + case 10: + strcpy(string, "0"); + break; + + case 11: + strcpy(string, "Y"); + break; + + case 12: + strcpy(string, "X"); + break; + + case 13: + strcpy(string, "Z"); + break; + + case 14: + strcpy(string, "S"); + break; + + case 15: + strcpy(string, "Q"); + break; + + default: + fprintf(stderr, "Warning symbol number is %d\n", symb_num); + strcpy(string, "*"); + break; + } + printf("%g %g 5 %g (%s) Text\n", absX, absY, char_angle, string); + } +} |